This is official tutorial. But it didn’t work for me for 100 %. But there is some useful information on wsgi and daemon process that should be created.
There is a good tutorial, that I followed and it actually works. But I decided to write my own post with instructions for my personal project:
First we enter the production server via SSL and create a virtual environment there:
1 |
virtualenv env |
Then we activate it:
1 |
source env/bin/activate |
Check the Django version. It must be the same as in your local server:
1 |
python -c "import django; print(django.get_version())" |
Save somewhere a path to a Django project:
1 |
/root/www/den.ladby.ru/public/common-app-server/app_server |
Your path will be different.
This is an example of a sites-available/*.conf file setting to run Django with WSGI:
Here app_server is the name of my Django project or you can name it a site. But in my case it is not site but server for a mobile application.
Python and Django version on server and virtual environment may be different. You should do everything inside virtual environments with the same versions on local and production servers.