Browse Source

Add support for being run as asgi instead of wsgi.

feature/long-poll-status
Daniel Perelman 1 year ago
parent
commit
f42edf2595
3 changed files with 17 additions and 0 deletions
  1. +12
    -0
      fear_tracker_site/asgi.py
  2. +4
    -0
      fear_tracker_site/routing.py
  3. +1
    -0
      fear_tracker_site/settings.py

+ 12
- 0
fear_tracker_site/asgi.py View File

@@ -0,0 +1,12 @@
"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""

import os
import django
from channels.routing import get_default_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fear_tracker_site.settings")
django.setup()
application = get_default_application()

+ 4
- 0
fear_tracker_site/routing.py View File

@@ -0,0 +1,4 @@
from channels.routing import ProtocolTypeRouter

# No async routing currently; just default sync http.
application = ProtocolTypeRouter({})

+ 1
- 0
fear_tracker_site/settings.py View File

@@ -69,6 +69,7 @@ TEMPLATES = [
]

WSGI_APPLICATION = 'fear_tracker_site.wsgi.application'
ASGI_APPLICATION = 'fear_tracker_site.routing.application'


# Database


Loading…
Cancel
Save