Використовуємо uwsgi та supervisor.

Встановлення uwsgi и supervisor.

apt-get install build-essential python3-dev

apt-get install uwsgi

sudo apt-get install uwsgi-plugin-python3

Настроювальний файл.

[uwsgi]
socket = /tmp/telegram.sock
chmod-socket = 666
processes = 1
threads = 2
virtualenv = /home/telegram/telegram-poster/venv/
chdir = /home/telegram/telegram-poster/telegram_poster
module = telegram_poster.wsgi:application
plugins = python3

Налаштування nginx.

    location / {
            uwsgi_pass      unix:/tmp/telegram.sock;
            include         uwsgi_params;
    }

    location ~ ^/(static|media)/ {
          root /home/django/myproj/myproj;
          expires max;
    }