django on apache2 with mod_wsgi


Sitename: vkrm

Location: /work/vkrm

1. Install mod_wsgi (and Apache if not already). I had both already installed (I checked for mod_wsgi by running “yum install mod_wsgi”). If not, follow instructions on:

2. Enable “mod_wsgi” and httpd.conf

su -c vi /etc/httpd/conf/httpd.conf

Add line:

LoadModule wsgi_module modules/

3. Create a static directory in your site. Inside the directory that contains “”, run:

mkdir static

4. Copy admin static files

python collectstatic
mv admin static

5. Create vkrm/apache/django.wsgi

import os import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'vkrm.settings'
import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()

6. Edit httpd.conf. Add:

WSGIScriptAlias /vkrm /work/vkrm/apache/django.wsgi
<Directory /work/vkrm/apache> Order allow,deny Allow from all </Directory>
Alias /static /work/vkrm/static
<Directory /work/vkrm/static> Options FollowSymLinks Order deny,allow Allow from all </Directory>

7. Restart Apache

su -c service restart httpd

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.