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 93f8e01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tin/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
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()


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

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

0 comments on commit 93f8e01

Please sign in to comment.