How to use the channels.routing.get_default_application function in channels

To help you get started, we’ve selected a few channels examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github raveberry / raveberry / main / asgi.py View on Github external
"""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", "main.settings")
django.setup()
application = get_default_application()
github KubeOperator / KubeOperator / core / fit2ansible / asgi.py View on Github external
import os
import django
from channels.routing import get_default_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fit2ansible.settings")
django.setup()
application = get_default_application()
github erm / asgi-examples / apps / _django / asgichat / asgi.py View on Github external
"""
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", "asgichat.settings")
django.setup()
application = get_default_application()
github nirdizati-research / predict-python / training / asgi.py View on Github external
"""
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", "myproject.settings")
django.setup()
application = get_default_application()
github Splawik / pytigon / schlib / schhttptools / httpclient.py View on Github external
def init_embeded_django():
    global ASGI_APPLICATION
    import django
    django.setup()
    from channels.routing import get_default_application
    ASGI_APPLICATION = get_default_application()
github overshard / timestrap / timestrap / asgi.py View on Github external
import os

import django

from channels.routing import get_default_application


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timestrap.settings.docker")


django.setup()


application = get_default_application()
github oTree-org / otree-core / otree_startup / asgi.py View on Github external
import os
import django
from channels.routing import get_default_application
from . import configure_settings
from django.conf import settings

# needed if uvicorn is launched multi-process
if not settings.configured:
    configure_settings()
    django.setup()

application = get_default_application()

# clear any tasks in Huey DB, so they don't pile up over time,
# especially if you run the server without the timeoutworker to consume the
# tasks.
# ideally we would only schedule a task in Huey if timeoutworker is running,
# so that we don't pile up messages that never get consumed, but I don't know
# how and when to check if Huey is running, in a performant way.
# this code is also in timeoutworker.
from huey.contrib.djhuey import HUEY  # noqa
import redis.exceptions
try:
    HUEY.flush()
except redis.exceptions.ConnectionError:
    # maybe Redis is not running
    pass
github fanout / django-eventstream / examples / chat / server / asgi.py View on Github external
import os
import sys

filepath = os.path.abspath(__file__)

sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(filepath)))))

import dotenv
dotenv.read_dotenv(os.path.join(os.path.dirname(os.path.dirname(filepath)), '.env'))

import django
from channels.routing import get_default_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings")
django.setup()
application = get_default_application()
github lutece-awesome / lutece-backend / Lutece / asgi.py View on Github external
"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""

import django
import os
from channels.routing import get_default_application

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