L
L
Luka Tarkhnishvili2020-09-10 13:42:18
Django
Luka Tarkhnishvili, 2020-09-10 13:42:18

How to set up a Django ASGI project on Ubuntu?

The project has a chat that uses Django-channels . This chat needs asynchrony (ASGI) to work. I do not use Redis, I use only sockets (reconnecting-websocket), on Windows everything works fine, but in production on Ubuntu everything is much more complicated.

I set everything up with this guide . and everything works well, WSGI is started with Gunicorn and gunicorn.service is created, I also created daphne.service in /etc/systemd/system/

daphne.service

[Unit]
Description=itwork Daphne Service
After=network.target

[Service]
Type=simple 
User=luka
WorkingDirectory=/home/luka/itworkdir
ExecStart=/home/luka/itworkdir/env/bin/daphne -u /home/luka/daphne.sock Career.asgi:application -v2

[Install]
WantedBy=multi-user.target

It also seems to start,
5f5a026394fec418274864.jpeg

but it still can’t connect to sockets
5f5a02bfcacbd775648714.jpeg

. I don’t understand what the problem is, I’ve been stuck on this for a month now.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question