Running Django project on Apache production server with mod_wsgi

No comments on Running Django project on Apache production server with mod_wsgi

django

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:

virtualenv env

Then we activate it:

source env/bin/activate

Check the Django version. It must be the same as in your local server:

python -c "import django; print(django.get_version())"

Save somewhere a path to a Django project:

/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:
Снимок экрана 2014-09-19 в 20.25.49

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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *