running django webapp on apache using mod_wsgi

I am new to working with apache and mod_wsgi. But I do have little experience in django, so from some tutorials I tried to run django app through apache webserver using mod_wsgi.
I created mysite in /var/www/
then in mysite/application I created application.wsgi …

import os
import sys

sys.path.append('/var/www/mysite/application')

os.environ['PYTHON_EGG_CACHE'] = '/var/www/mysite/.python-egg'

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and in /etc/httpd/sites-available I created file named mysite.conf …

<VirtualHost *:80>
   ServerName mysite.com
   ServerAdmin id@somewhere.com
   ServerAlias mysite.com
   DocumentRoot /var/www/mysite/   
<Directory /var/www/mysite>
Options FollowSymLinks
AllowOverride None
  Order allow,deny
  Allow from all
  SetEnv DJANGO_SETTINGS_MODULE mysite.settings
</Directory>
WSGIDaemonProcess mysite processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup mysite
</Virtualhost>

then I ran a2ensite mysite.conf didn’t showed any error.
then in /etc/httpd/hosts/ I added one line my-ipddress mysite.com
I gave permission chmod 777 to all the above files and to folder /var/www/mysite.Now when I open mysite.com on browser I see apahce’s default page nothing from django

and I am using fedora 21.


Source: apache

Leave a Reply