Not sure if this is the right place to ask this question, but I'm migrating a django project from mod_python to mod_wsgi and I want to make sure I have my apache configuration correct. The old configuration looks like this:

DocumentRoot /srv/www/PROJECT/
    <location "/">
            Options +FollowSymLinks
            allow from all
            SetHandler python-program
            PythonHandler django.core.handlers.modpython
            SetEnv DJANGO_SETTINGS_MODULE PROJECT.settings
            PythonPath "['/srv/www/PROJECT'] + sys.path"
            PythonDebug On                
            PythonInterpreter PROJECT
    <location "/site_media/">
            Options +FollowSymLinks
            SetHandler None
    <location "/admin_media/">
            Options +FollowSymLinks
            SetHandler None

<Location "/server-status">
    SetHandler server-status
    Allow from .test.org localhost

Reading the documentation, it seems like all I have to do is:

    WSGIDaemonProcess PROJECT processes=2 threads=15 display-name=%{GROUP}
    WSGIProcessGroup PROJECT
    WSGIScriptAlias /PROJECT /srv/www/django.wsgi

    <Directory /srv/www/PROJECT/ >
            Order allow,deny
            Allow from all

    Alias /site_media "/srv/www/site_media/"
    Alias /admin_media "/srv/www/admin_media/"

With django.wsgi containing:

 import os,sys
 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

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

Do these look like the appropriate changes? I am not too familiar with mod_python (I didn't set this site up- it's just my job now to migrate it :( ) so I'm not sure on the conversion. Any other advice would be much appreciated.

  • Why don't you try the configuration which documentation for mod_wsgi says to use and see if it works? Just make sure you disable mod_python from same Apache so it doesn't cause issues. – Graham Dumpleton Jun 2 '12 at 2:02
  • It seems to half work- I'll post updated results if I get it working. – thomascirca Jun 5 '12 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.