installing django mod_wsgi and apache on freeBSD Created On Nov 23, 2009
Brief:
want to install django with apache with wsg handler on FreeBSD. for this i also Need to install and enable mod_wsgi module for apache
Description:

Now will make django handeling related changes in config file for virtual host. Following config files works for me


    ServerName

    DirectoryIndex index.html
    DocumentRoot

   
    Order allow,deny
    Allow from all
   


    WSGIScriptAlias / //django.wsgi

   
      Options ExecCGI
      AddHandler wsgi-script .wsgi

     
        Order allow,deny
        Allow from all
     

     
        Order allow,deny
        Allow from all
     


   


    Alias /media/ "/trunk/django/contrib/admin/media/"
    /trunk/django/contrib/admin/media">
    Order allow,deny
    Options Indexes
    Allow from all
    IndexOptions FancyIndexing
   


    ErrorLog /var/log/-error_log
    CustomLog /var/log/-access_log common



Now please create wsgi hander script as

import sys
import os

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')

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

import django.core.handlers.wsgi

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


Back to Articles