diff --git a/piccolo/apps/asgi/commands/new.py b/piccolo/apps/asgi/commands/new.py index 38a056295..70ecefdc8 100644 --- a/piccolo/apps/asgi/commands/new.py +++ b/piccolo/apps/asgi/commands/new.py @@ -10,10 +10,14 @@ TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates/app/") SERVERS = ["uvicorn", "Hypercorn"] -ROUTERS = ["starlette", "fastapi", "blacksheep", "litestar", "esmerald"] ROUTER_DEPENDENCIES = { + "starlette": ["starlette"], "fastapi": ["fastapi>=0.100.0"], + "blacksheep": ["blacksheep"], + "litestar": ["litestar"], + "esmerald": ["esmerald"], } +ROUTERS = list(ROUTER_DEPENDENCIES.keys()) def print_instruction(message: str): diff --git a/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja b/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja index a69df7706..60560b980 100644 --- a/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja +++ b/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja @@ -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, @@ -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], diff --git a/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja b/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja index 7bbb8ba53..828796740 100644 --- a/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +++ b/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja @@ -2,7 +2,5 @@ {{ router_dependency }} {% endfor -%} {{ server }} -jinja2 -piccolo[postgres] -piccolo_admin -requests +piccolo[postgres]>=1.0.0 +piccolo_admin>=1.0.0 \ No newline at end of file