Hello folks,

I have facing the same problem mentioned in the stackoverflow question
here ( 
http://stackoverflow.com/questions/962533/django-modpython-error-importerror-could-not-import-settings
). The solution doesn't seem to work

Problem description The app runs fine using django internal server
however when I use apache + mod_python I get the below error

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

Here is the needed information

1) Project directory: /root/djangoprojects/mysite

2) directory listing of /root/djangoprojects/mysite 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

3) App directory : /root/djangoprojects/mysite/polls

4) directory listing of /root/djangoprojects/mysite/polls 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

5) Anywhere in the filesystem running import django in python
interpreter works fine

6) content of httpd.conf

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

7) PYTHONPATH variable is set to

echo $PYTHONPATH /root/djangoprojects/mysite

8) DJANGO_SETTINGS_MODULE is set to echo $DJANGO_SETTINGS_MODULE
mysite.settings

9) content of sys.path is

import sys

            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']

How do I add settings location to sys.path such that it persistent
across sessions ?

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.

Looking for some help.

Thanks in advance Ankur Gupta

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to