I have spent the last 2 days attempting to deploy a Django application I've built and tested using the development server built into manage.py. I've read countless tutorials and snippets, and cannot seem to get anything working correctly. At my wits end, I've come here seeking advice.

Can anyone point me toward a start-to-finish tutorial or blog post that will take me out of the development server and onto Apache + mod_wsgi?

Edit: Having read through the Apache httpd.conf file, I have begun to understand more what Apache is doing, and what the tutorials are doing. However, having completed the Django + mod_wsgi tutorial, substituting in my paths where appropriate, and restarting apache, my / is still mapping to "It works!", the standard Mac Apache success page.

Here is the code I took from the Django tutorial, converted for my purposes, and put at the end of my httpd.conf...

    # Django configuration

WSGIScriptAlias / /Users/administrator/Developer/billing/apache/django.wsgi

<Directory /Users/administrator/Developer/billing/apache/django.wsgi>
Order allow,deny
Allow from all

AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1

Alias /media/ /Users/administrator/Developer/billing/media/
Alias /static/ /Users/administrator/Developer/billing/static/

<Directory /Users/administrator/Developer/billing/static>
Order deny,allow
Allow from all

<Directory /Users/administrator/Developer/billing/media>
Order deny,allow
Allow from all

Edit #2: The "It works!" page must have been cached, because having changed nothing from the above posted code, I now get a permission denied error when I try to go to /.

  • What is the specific obstacle are you running in to? What tutorials have you tried? More specific information will help with getting your question answered. – Nic Young Feb 21 '12 at 17:42
  • The primary obstacle is how gosh darned simple it is to set up the development server, and how relatively complicated it seems to be to move from that simplicity into even a simple production environment. I have tried using the official django + mod_wsgi tutorial: docs.djangoproject.com/en/1.3/howto/deployment/modwsgi as well as a smattering of miscellaneous blogs and such. I think what is hurting me the most is that I have no experience deploying Apache. I've only ever used one-click/command development servers. It is hard for me to even know where to start. Most tuts assume a lot. – patrickn Feb 21 '12 at 17:52
  • I'm starting to feel like coding the application is the easy part! – patrickn Feb 21 '12 at 17:53
  • It is also worth noting that this application is entirely internal. Many tutorials are focused on outward-facing applications and web servers. What I need is something simple, really; it just needs to serve multiple Django projects on a small (~100 users), internal network. – patrickn Feb 21 '12 at 17:57

Have you watched:


Otherwise, explain the exact problem you are having.

  • I have not, but please note the series of edits I've made up above. :] Thanks! – patrickn Feb 21 '12 at 22:54
  • Watch it, is explains the reasons for the error you finally posted up. – Graham Dumpleton Feb 22 '12 at 0:13
  • Graham, having followed the slides and copied each one carefully, I am still not up and running. On slide 8, a forbidden error is shown - having followed each step up to this point, my server returns a configuration error instead of permission error. The WSGIScriptAlias step produces a permission denied error as expected, but the next step gives me server config error. – patrickn Feb 22 '12 at 15:52
  • Success! Using code.google.com/p/modwsgi/wiki/IntegrationWithDjango, I noticed that they did two sys.path.append commands... one for the root folder containing the django project, and another for the actual project itself (which your slideshow uses)... adding in the root folder to the path solved the problem! – patrickn Feb 22 '12 at 16:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.