Skip to content

Commit

Permalink
add piccolo_admin to _esmerald_app.py.jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Jan 23, 2024
1 parent f06384d commit c0d6413
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ from pathlib import Path

from piccolo.utils.pydantic import create_pydantic_model
from piccolo.engine import engine_finder
from piccolo_admin.endpoints import create_admin

from esmerald import (
Esmerald,
Expand Down Expand Up @@ -92,7 +93,15 @@ class TaskAPIView(APIView):
app = Esmerald(
routes=[
Gateway("/", handler=home),
Gateway("/tasks", handler=TaskAPIView)
Gateway("/tasks", handler=TaskAPIView),
Include(
"/admin/",
create_admin(
tables=APP_CONFIG.table_classes,
# Required when running under HTTPS:
# allowed_hosts=['my_site.com']
),
),
],
static_files_config=StaticFilesConfig(path="/static", directory=Path("static")),
on_startup=[open_database_connection_pool],
Expand Down

0 comments on commit c0d6413

Please sign in to comment.