Example 2 with WSGIDaemonProcess ¶
Introduction ¶
How to Run Django with mod_wsgi and Apache with a virtualenv.
pair django with apache server ¶
Create a specific site sampleapp:
vi /etc/apache2/sites-available/sampleapp.conf
add below line to that file
1 <VirtualHost *:80>
2 ServerName staging.djangoer.com
3 DocumentRoot /home/mysite/www
4
5 WSGIDaemonProcess sampleapp python-path=/home/mysite/www:/home/mysite/myenv/lib/python2.7/site-packages
6 WSGIProcessGroup sampleapp
7 WSGIScriptAlias / /home/mysite/www/django_sample/wsgi.py
8 Alias /static /home/mysite/www/static
9
10 ErrorLog /home/mysite/error.log
11 CustomLog /home/mysite/access.log combined
12
13 <Directory /home/mysite/www>
14 Require all granted
15 </Directory>
16
17 </VirtualHost>
enable it and restart apache:
a2ensite sampleapp
service apache2 reload