Skip to content

Commit

Permalink
Reorder imports to fix error in asgi.py (see below)
Browse files Browse the repository at this point in the history
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
  • Loading branch information
krishnans2006 committed May 3, 2024
1 parent e889337 commit db0beb2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tin/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
from django.core.asgi import get_asgi_application
from django.urls import path

from .apps.submissions.consumers import SubmissionJsonConsumer

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tin.settings")
# Initialize Django ASGI application early to ensure the AppRegistry
# is populated before importing code that may import ORM models.
django_asgi_app = get_asgi_application()


from .apps.submissions.consumers import SubmissionJsonConsumer # fmt: off


class WebsocketCloseConsumer(WebsocketConsumer):
Expand All @@ -36,7 +40,7 @@ def disconnect(self, code):

application = ProtocolTypeRouter(
{
"http": get_asgi_application(),
"http": django_asgi_app,
"websocket": AuthMiddlewareStack(
URLRouter(
[
Expand Down

0 comments on commit db0beb2

Please sign in to comment.