inicia o projeto com traefik e uvicorn
This commit is contained in:
39
config/asgi.py
Normal file
39
config/asgi.py
Normal file
@ -0,0 +1,39 @@
|
||||
"""
|
||||
ASGI config for Diarios Oficiais Search ALEMS 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
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
# This allows easy placement of apps within the interior
|
||||
# diarios_oficiais_search_alems directory.
|
||||
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
|
||||
sys.path.append(str(BASE_DIR / "diarios_oficiais_search_alems"))
|
||||
|
||||
# If DJANGO_SETTINGS_MODULE is unset, default to the local settings
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||
|
||||
# This application object is used by any ASGI server configured to use this file.
|
||||
django_application = get_asgi_application()
|
||||
|
||||
# Import websocket application here, so apps from django_application are loaded first
|
||||
from config.websocket import websocket_application # noqa: E402
|
||||
|
||||
|
||||
async def application(scope, receive, send):
|
||||
if scope["type"] == "http":
|
||||
await django_application(scope, receive, send)
|
||||
elif scope["type"] == "websocket":
|
||||
await websocket_application(scope, receive, send)
|
||||
else:
|
||||
msg = f"Unknown scope type {scope['type']}"
|
||||
raise NotImplementedError(msg)
|
||||
Reference in New Issue
Block a user