New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
daphne with django 3 #292
Comments
ok i fixed it , i run the server via manage.py to ensure that works and then fix the supervisor about daphne |
Hi, I am facing this issue. It works fine on django built-in development server but it throws above error on daphne. I want to run my server on daphne instead of built-in dev server for production. |
i will create a a basic project with celery and django channels |
I am also experiencing this error Daphne is spitting out the same error: |
@louisliv getting the same issue. Did you manage to fix it? |
@dwjorgeb I did not. I can confirm it works using Django's runserver command instead of daphne, but I would prefer not to use Django's built in server for production. |
@louisliv same, I can't use Django's built-in server for production. It's weird that I can't find any documentation, either on Channels or on Django about this apparent incompability |
I managed to fix by using "get_default_application()" instead of "get_asgi_application()" in asgi.py . I don't have access to my system at this point so can't share exact code. Let me know if issue still persists. |
@Sahil624 Where do you imported it? I don't have a |
My """
ASGI config for server 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/3.0/howto/deployment/asgi/
"""
import os
import django
# from django.core.asgi import get_asgi_application
from channels.routing import get_default_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
django.setup()
# application = get_asgi_application()
application = get_default_application() |
@Sahil624 that worked for me. |
@Sahil624 thanks, that actually worked for me. We can't use Django 3's ASGI file, we need to overwrite the ASGI file with the Channels' code (the one you put above, from here: https://channels.readthedocs.io/en/latest/deploying.html#run-protocol-servers ) thanks for pointing me in the right direction! |
Django 3.0 does not support websockets. Continue to use Channels for this. |
Glad it worked for all. |
@Sahil624 can you help me with running a default method as soon as the server is run? |
Sahil624 you save me. I am so thankful for what you did. |
When i ran daphne with unix socket and django version 3 i get this error Django can only handle ASGI/HTTP connections, not websocket.
I try to run the django channels tutorial with nginx gunicorn supervisor and daphne
The text was updated successfully, but these errors were encountered: