Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to deploy on a VM with centos 6.4 a basic django project with apache and mod_wsgi. This is the project tree:

├── myapp
│   ├──
│   ├──
│   ├──
│   └──
└── myproj
    ├── __init__.pyc
    ├── settings.pyc

this is the file (it's the default generated by startproject):

WSGI config for myproj project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another

import os

# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "myproj.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproj.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

and this is the virtualhost configuration (/etc/httpd/conf/httpd.conf):

#WSGIPythonPath /home/www/myproj/myproj
<VirtualHost *:82>
     WSGIScriptAlias /django /home/www/myproj/mypproj/
     WSGIDaemonProcess myproj user=apache threads=3
     <Directory />
        Options FollowSymLinks
        AllowOverride None
     DocumentRoot /tmp
     ErrorLog /var/log/httpd/error_log
     CustomLog /var/log/httpd/access_log combined

while i can access to index apache page ( on my local network), if i try to point my broser on i get "Destination unreachable". Any idea of what is missing or what is wrong in the configuration? on access or error log there's no trace of activity...

this is the modified virtualhost configuration:

<VirtualHost *:82>
     WSGIScriptAlias /django /home/www/myproj/myproj/
     WSGIDaemonProcess myproj user=apache threads=3 python-path=/home/www/myproj/myproj/:/usr/lib/python2.6/site-packages
     WSGIProcessGroup myproj
     <Directory /home/www/myproj/myproj>
            Order allow,deny
            Allow from all
     #DocumentRoot /tmp
     #Alias /media/ /home/www/myproj/
     ErrorLog /var/log/httpd/error_log
     CustomLog /var/log/httpd/access_log combined

...nothing has changed. On:


I get "Connection refused". The same configuration on a Debian machine works (in that case is mapped on port 80). Any help?

share|improve this question
Unlreated, but you are missing a WSGIProcessGroup directive. Go read about what that does. Without it your application isn't going to run in that mod_wsgi daemon process group. – Graham Dumpleton Apr 14 '13 at 22:44
BTW, bad idea to set DocumentRoot to '/tmp' especially when you have your Django application hosted as a sub URL. If you managed elsewhere in your Apache configuration to say that Apache can serve up files from '/tmp' people could download files out of '/tmp' because of that DocumentRoot setting. – Graham Dumpleton Apr 15 '13 at 2:13
tnx. to summarize what is missing for have a working configuration? – Luke Apr 15 '13 at 7:23
up vote 0 down vote accepted

If you want to access port 82 directly, you'll need to open the appropriate port in the server's firewall. You can do this with the system-config-firewall-tui command line tool.

share|improve this answer
it has been deactivated as well – Luke Apr 14 '13 at 21:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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