Деплой Django проекта на сервер.

Basics of Python and Django. -> Используем uwsgi и supervisor.

Используем 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;
    }