My django application loaded in Apache/mod_wsgi cannot find my exterior packages despite the fact that I specified it in sys.path?

The setup is the following:

a) the exterior packages have been in /var/www/site/my/python/config

b) the django website (using the file) is within /var/www/site/domain

c) the wsgi configuration file is:

import os, sys
sys.stdout = sys.stderr

# Add the virtual Python environment site-packages directory to the path
import site

# Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages
os.environ['PYTHON_EGG_CACHE'] = '/var/www/egg-cache'

# Add project directory to PYTHONPATH
sys.path.append('/var/www/site') # <---- THIS SHOULD FIND EXTERNAL PACKAGES?
os.environ['DJANGO_SETTINGS_MODULE'] = 'domain.settings'

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

d) the file begins using the following:

print "prior to import"
from my.python.config import ConfigParser # <---- THIS EXIST AS INDICATED IN a), but fails!
print after to import"

DEBUG = True

    # ('Your Name', ''),



The mistake I am getting is:

prior to import
mod_wsgi (pid=3465): Exception occurred processing WSGI script '/var/www/mod_wsgi/django.wsgi'.
Traceback (most recent call last):
   File "/var/www/virtualenv/lib/python2.6/site-packages/django/core/handlers/", line 250, in __call__
   File "/var/www/virtualenv/lib/python2.6/site-packages/django/core/handlers/", line 39, in load_middleware
     for middleware_path in settings.MIDDLEWARE_CLASSES:
   File "/var/www/virtualenv/lib/python2.6/site-packages/django/utils/", line 276, in __getattr__
   File "/var/www/virtualenv/lib/python2.6/site-packages/django/conf/", line 42, in _setup
     self._wrapped = Settings(settings_module)
   File "/var/www/virtualenv/lib/python2.6/site-packages/django/conf/", line 89, in __init__
     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
 ImportError: Could not import settings 'domain.settings' (Is it on sys.path?): No module named python.config

You can observe the file is attempted loaded as "just before import" is printed, however the code failes on posting "my.python.config.ConfigParser". It appears to identify it as being python.config rather though?

Any clues?

I've been tearing my hair out all day long. Everything however works in eclipse atmosphere by directly invoking ' runserver 80' after setting the python path and also the django atmosphere variables. I additionally verified the python path is within sys.path.

I went from ideas, so ANY help could be much appreciated!

Add at oncoming of

import my
print my.__file__

Validate the path printed out is perfect for the 'my' package you anticipate.

Quite simply, it may be obtaining another 'my' package due to this type of package existing in multiple locations and also the order of sys.path being wrong.

Also make certain you decide to go read:

which discusses sys.path ordering issues.

Have you got in most the subdirectories and it is kids of /var/www/site

whenever you access my.python.config, must be there within my directory, python directory and config directory.

Regarding permission, wsgi is going to be run as apache user (user you've specified by wsgi.conf). Take proper care of it.