title: Django newbie deployment question - ImportError: Could not import settings 'settings'
body: <p>The app runs fine using django internal server however when I use apache + mod_python I get the below error </p>
  
  <hr>
  
  <pre><code>  File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75, in __init__
      raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
  
  ImportError: Could not import settings 'settings' (Is it on sys.path? Does it have syntax errors?): No module named settings
  </code></pre>
  
  <hr>
  
  <p>Here is the needed information </p>
  
  <p>1) Project directory: /root/djangoprojects/mysite</p>
  
  <p>2) directory listing of /root/djangoprojects/mysite</p>
  
  <pre><code>ls -ltr
  total 28
  -rw-r--r-- 1 root root  546 Aug  1 08:34 manage.py
  -rw-r--r-- 1 root root    0 Aug  1 08:34 __init__.py
  -rw-r--r-- 1 root root  136 Aug  1 08:35 __init__.pyc
  -rw-r--r-- 1 root root 2773 Aug  1 08:39 settings.py
  -rw-r--r-- 1 root root 1660 Aug  1 08:53 settings.pyc
  drwxr-xr-x 2 root root 4096 Aug  1 09:04 polls
  -rw-r--r-- 1 root root  581 Aug  1 10:06 urls.py
  -rw-r--r-- 1 root root  314 Aug  1 10:07 urls.pyc
  </code></pre>
  
  <p>3) App directory : /root/djangoprojects/mysite/polls</p>
  
  <p>4) directory listing of /root/djangoprojects/mysite/polls </p>
  
  <pre><code>ls -ltr
  total 20
  -rw-r--r-- 1 root root 514 Aug  1 08:53 tests.py
  -rw-r--r-- 1 root root  57 Aug  1 08:53 models.py
  -rw-r--r-- 1 root root   0 Aug  1 08:53 __init__.py
  -rw-r--r-- 1 root root 128 Aug  1 09:02 views.py
  -rw-r--r-- 1 root root 375 Aug  1 09:04 views.pyc
  -rw-r--r-- 1 root root 132 Aug  1 09:04 __init__.pyc
  </code></pre>
  
  <p>5) Anywhere in the filesystem running import django in python interpreter works fine</p>
  
  <p>6) content of httpd.conf</p>
  
  <pre><code>&lt;Location "/mysite"&gt;
      SetHandler python-program
      PythonHandler django.core.handlers.modpython
      SetEnv DJANGO_SETTINGS_MODULE settings
      PythonOption django.root /mysite
      PythonPath "['/root/djangoprojects/', '/root/djangoprojects/mysite','/root/djangoprojects/mysite/polls', '/var/www'] + sys.path"
      PythonDebug On
  &lt;/Location&gt;
  </code></pre>
  
  <p>7) PYTHONPATH variable is set to </p>
  
  <pre><code>echo $PYTHONPATH
  /root/djangoprojects/mysite
  </code></pre>
  
  <p>8) DJANGO_SETTINGS_MODULE is set to</p>
  
  <pre><code>echo $DJANGO_SETTINGS_MODULE
  mysite.settings
  </code></pre>
  
  <p>9) content of sys.path is </p>
  
  <pre><code>import sys
  &gt;&gt;&gt; sys.path
  ['', '/root/djangoprojects/mysite', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/local/lib/python2.6/dist-packages']
  </code></pre>
  
  <p>How do I add settings location to sys.path such that it persistent across sessions ? </p>
  
  <p>I have read umpteen no of post with people having the same issue it and I have tried a lot completely beats me as to what I need to do.</p>
  
  <p>Looking for some help.</p>
  
  <p>Thanks in advance
  Ankur Gupta</p>