Skip to content

Commit 5641c1a

Browse files
committed
added allowed_hosts to ASGI template
``create_admin`` was missing ``allowed_hosts`` argument, which is required under HTTPS.
1 parent eee7cd7 commit 5641c1a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

piccolo/apps/asgi/commands/templates/starlette/_fastapi_app.py.jinja

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ from home.piccolo_app import APP_CONFIG
1616
app = FastAPI(
1717
routes=[
1818
Route("/", HomeEndpoint),
19-
Mount("/admin/", create_admin(tables=APP_CONFIG.table_classes)),
19+
Mount(
20+
"/admin/",
21+
create_admin(
22+
tables=APP_CONFIG.table_classes,
23+
# Required when running under HTTPS:
24+
# allowed_hosts=['my_site.com']
25+
)
26+
),
2027
Mount("/static/", StaticFiles(directory="static")),
2128
],
2229
)

piccolo/apps/asgi/commands/templates/starlette/_starlette_app.py.jinja

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ from home.tables import Task
1313
app = Starlette(
1414
routes=[
1515
Route("/", HomeEndpoint),
16-
Mount("/admin/", create_admin(tables=APP_CONFIG.table_classes)),
16+
Mount(
17+
"/admin/",
18+
create_admin(
19+
tables=APP_CONFIG.table_classes,
20+
# Required when running under HTTPS:
21+
# allowed_hosts=['my_site.com']
22+
)
23+
),
1724
Mount("/static/", StaticFiles(directory="static")),
1825
Mount("/tasks/", PiccoloCRUD(table=Task))
1926
],

0 commit comments

Comments
 (0)