Install uwsgi:
apt-get install build-essential python sudo pip3 install uwsgi
Create a service in /etc/systemd/system/uwsgi.service
[Unit] Description=uWSGI Emperor service [Service] ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown www-data:www-data /run/uwsgi' #ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites #ExecStart=/usr/local/bin/uwsgi --http 0.0.0.0:8001 --wsgi-file stocks/wsgi.py --master -b 30000 --enable-threads --processes 4 --threads 2 ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites Restart=always KillSignal=SIGQUIT Type=notify NotifyAccess=all [Install] WantedBy=multi-user.target
Create an emperor file at:
sudo mkdir /etc/uwsgi sudo mkdir /etc/uwsgi/sites sudo vi /etc/uswsgi/sites/stocks.ini
And then add:
[uwsgi] project = stocks uid = bpopp base = /usr/share/nginx/html/django chdir = %(base)/%(project) #wsgi-file = %(project)/wsgi.py module=%(project).wsgi:application #module=django.core.handlers.wsgi:WSGIHandler() master = true processes = 5 threads=2 http = 0.0.0.0:8001 #chown-socket = %(uid):www-data #chmod-socket = 664 #vacuum = true #plugins=python