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've already done my best to follow the instructions at, 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 '' (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
    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/ 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. :)

share|improve this question

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.

share|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 :

share|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 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.