Spaces:
Running
on
Zero
Running
on
Zero
File size: 803 Bytes
02ebbc8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
"""
ASGI config for mysite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
"""
import os
from django.conf import settings
from django.core.asgi import get_asgi_application
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_asgi_application()
fastapp = FastAPI()
def init(app: FastAPI):
from polls.routers import register_routers
register_routers(app)
if settings.MOUNT_DJANGO_APP:
app.mount("/django", application) # type:ignore
app.mount("/static", StaticFiles(directory="staticfiles"), name="static")
init(fastapp)
|