Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

This seems to be a common problem for many others, but none of the other fixes have helped me. Here's my apache2/sites-available file:

<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE getgps.settings
    PythonOption django.root /
    PythonDebug On

Alias /media/css /home/getgps/media/css
<Location "/media/css">
    SetHandler None

And the error message:

Error: Could not import settings 'code.settings' (Is it on sys.path? Does it have syntax errors?): No module named settings is located in /home/getgps/code/ and /home/getgps/code is linked such that it is getgps in the python environment (if I type import getgps.settings into a command line it imports the file in question independent of where I am when I load the python command line).

tldr: sybolic link works, apache file is great, but it doesn't seem to like my file structure.

share|improve this question
up vote 0 down vote accepted

You have to comment out:

PythonOption django.root /

as it is not needed (and doesn't work in this case). You only need to use this line if your site is not at DocRoot.

Obs: if you can it is recommended to switch from mod_python to mod_wsgi but not all providers accept it as it needs restarting apache sometimes.

share|improve this answer

I finally just moved the code into the parent directory (and redid the symbolic link) and it worked fine. I have no idea why it wasn't working. The previous code bases I've worked on were all set up like this...

share|improve this answer

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.