(Tested on Ubuntu 14.04 and Apache 2.4.7)
sudo apt-get install libapache2-mod-wsgi
sudo a2enmod wsgi
Go to project folder and collect static files (setting STATIC_ROOT must be specified) - python manage.py collectstatic
Add site config to the folder etc/apache2/sites-available
:
Listen 8030
<VirtualHost *:8030>
WSGIScriptAlias / /path/to/Project/Project/wsgi.py
WSGIDaemonProcess mysite python-path=/path/to/Project:/path/to/Project-Env
WSGIProcessGroup mysite
Alias /static /path/to/Project/static
Alias /media /path/to/Project/media
<Directory /path/to/Project/static>
Require all granted
</Directory>
<Directory /path/to/Project/media>
Require all granted
</Directory>
<Directory /path/to/Project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
sudo a2ensite.conf
sudo service apache2 restart
-
Attempt to write a readonly database
chmod 664 db.sqlite3
sudo chown :wwww-data db.sqlite3
-
Unable to open database file
sudo chown :www-data .
-
Permission denied for media folder
sudo chown :www-data ./media/ -R