Skip to content

Commit 24c257a

Browse files
committed
tweak blacksheep template
1 parent 3b3bb2e commit 24c257a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import typing as t
22

3+
from piccolo_admin.endpoints import create_admin
34
from piccolo_api.crud.serializers import create_pydantic_model
45
from piccolo.engine import engine_finder
56

@@ -10,11 +11,20 @@ from blacksheep.server.openapi.v3 import OpenAPIHandler
1011
from openapidocs.v3 import Info
1112

1213
from home.endpoints import home
14+
from home.piccolo_app import APP_CONFIG
1315
from home.tables import Task
1416

1517

1618
app = Application()
1719

20+
app.mount(
21+
"/admin/",
22+
create_admin(
23+
tables=APP_CONFIG.table_classes,
24+
# Required when running under HTTPS:
25+
# allowed_hosts=['my_site.com']
26+
),
27+
)
1828

1929
docs = OpenAPIHandler(info=Info(title="Example API", version="0.0.1"))
2030
docs.bind_app(app)

piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
</ul>
4949
<h3>BlackSheep</h3>
5050
<ul>
51+
<li><a href="/admin/">Admin</a></li>
5152
<li><a href="/docs/">Swagger API</a></li>
5253
</ul>
5354
</section>

0 commit comments

Comments
 (0)