Skip to content

Commit

Permalink
granian support in asgi templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sinisaos committed Aug 16, 2024
1 parent 2589729 commit 3d6ba49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions piccolo/apps/asgi/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from jinja2 import Environment, FileSystemLoader

TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates/app/")
SERVERS = ["uvicorn", "Hypercorn"]
SERVERS = ["uvicorn", "Hypercorn", "granian"]
ROUTER_DEPENDENCIES = {
"starlette": ["starlette"],
"fastapi": ["fastapi>=0.100.0"],
"fastapi": ["fastapi>=0.112.1"],
"blacksheep": ["blacksheep"],
"litestar": ["litestar"],
"esmerald": ["esmerald"],
Expand Down
4 changes: 4 additions & 0 deletions piccolo/apps/asgi/commands/templates/app/main.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ if __name__ == "__main__":
asyncio.run(serve(app, CustomConfig()))

serve(app)
{% elif server == 'granian' %}
import granian

granian.Granian("app:app", interface="asgi").serve()
{% endif %}

0 comments on commit 3d6ba49

Please sign in to comment.