Reputation: 31
I need to use websocket in django, so I read docs of channels. Now I know the basic concepts but still confused because there's few code in detail.
Here are my questions:
How can I make ASGI align with the WSGI in code? In other words, how to configure WSGI Server to ASGI
or ASGI to WSGI application
?
Does it affect the way of using ajax?
Does it affect that if the django sends http request to other website?
Any help will be appreciated.
Upvotes: 1
Views: 1132
Reputation: 10305
If you want to use new ASGI spec then define CHANNEL_LAYERS
in settings.py
. If you are not set then this just run and work like a normal WSGI app.
When you set above ( to ASGI
) you have two options, either route all traffic through ( in this case HTTP/Websocket
) to interface server ( daphne
). Or you can route all the websockets and long polling http connection to interface server
Deploying document here if you want to take look
Upvotes: 1