Django channels works in local Ubuntu server but while in production it is not working , website shows 502 error and daphne failed due to too quick restart( i setup systemd for daphne) can any one send configuration of daphne (systemd) and nginx … Please🙏
I’m sorry, but it doesn’t work that way. There are too many variables involved for you to take someone elses configuration and just plug it in. The only way of being sure that you get a valid configuration is to work through the configuration errors that you are getting.
If Daphne itself is failing, that’s usually a Python / Daphne / Project issue having nothing to do with nginx. (Nginx isn’t going to cause the Daphne process to fail.)
If you’re just looking for some general ideas, you can search this “Deployment” section of the forum and find a number of examples.
Otherwise, the best way for us to be able to help you is if you start by checking your logs to find where the errors are being reported (syslog, etc) and post the error you are getting from your daphne process. Also, it would be helpful if you posted your systemd file for Daphne, your wsgi.py / asgi.py file, your nginx configuration sections for it, and a description of the directory structure where you’re deploying your project.