I've already done my best to follow the instructions at http://docs.djangoproject.com/en/dev/howto/deployment/modpython/, but a customer is transferring a website to us, and I suspect the original developer's methods were a bit, uh, different.

So, first the full error message:

ImportError: Could not import settings 'settings.py' (Is it on sys.path? Does it have syntax errors?): No module named py

Then, the apache configuration for the site:

<Location /acecoach/>
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings.py
    PythonOption django.root /acecoach
    PythonPath "['/home/acecoach/public_html/acecoach'] + sys.path"
    PythonDebug On

Now, the "settings module" as far as I know, is located in /home/acecoach/public_html/acecoach/settings.py This file is readable by the apache server - I tested this by actually SU-ing to the apache user and reading the file from the command line.

I've also read similar advice on this error message, and found no useful help in this regard. It's driving me nuts. :)


Remove the .py file extension and add the project context to your settings module definition. Assuming that your project is called acecoach.

SetEnv DJANGO_SETTINGS_MODULE acecoach.settings

The Python documentation explains the reason simpler than I shall attempt to.


A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.


Packages are a way of structuring Python’s module namespace by using “dotted module names”. For example, the module name A.B designates a submodule named B in a package named A.

| improve this answer | |
  • Because they only have directory '/home/acecoach/public_html/acecoach' in PythonPath, they would actually use 'settings' and not 'acecoach.settings'. Rather than do that though, they should add '/home/acecoach/public_html' to PythonPath as well and keep using 'acecoach.settings'. – Graham Dumpleton Dec 30 '09 at 10:30

Hey , i had same problem in mod_python too , but when i migrate to apache + mod_wsgi all of my proplems solved .
why you didn't try mod_wsgi ?
it's newer than mod_python and haven't such problems .
but if wanna solve it , you can go to this address :

| improve this answer | |
  • Yours was a different issue. This person was using Python file extension when they shouldn't have. – Graham Dumpleton Dec 30 '09 at 10:31

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.