Error on Running Django on Apache2.2 ......Could Not Import Setting....

5 views
Skip to first unread message

mralokkp

unread,
Mar 1, 2007, 1:33:40 PM3/1/07
to Django users
Hello help me out this problem
I am Getting this error while accessing my project URL

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

File "/usr/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 177, in handler
return ModPythonHandler()(req)

File "/usr/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 145, in __call__
self.load_middleware()

File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 22, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 28, in __getattr__
self._import_settings()

File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 55, in _import_settings
self._target = Settings(settings_module)

File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 83, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e)

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

My http.conf is This
.
.
.
.
<Location "/myproject/">
SetHandler python-program
PythonPath "['/home/user'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
SetHandler python-program
PythonDebug On
</Location>
.
.
.
.

I searched on google a lot but unable to find a suitable clue
Other Information My System is linux
Required installation complete.(According to resources available on
the django project site)
I was running successfully on django itself but migration to apache
cause such bug.
help me
I will be thankfull to to you

A

Jeremy Dunck

unread,
Mar 1, 2007, 1:37:34 PM3/1/07
to django...@googlegroups.com
On 3/1/07, mralokkp <mral...@gmail.com> wrote:
....

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

Where is myproject.settings located?

mralokkp

unread,
Mar 1, 2007, 1:41:49 PM3/1/07
to Django users
Locate on /home/user/myproject

On Mar 1, 11:37 pm, "Jeremy Dunck" <jdu...@gmail.com> wrote:

Jeremy Dunck

unread,
Mar 1, 2007, 2:01:28 PM3/1/07
to django...@googlegroups.com
On 3/1/07, mralokkp <mral...@gmail.com> wrote:
>
> Locate on /home/user/myproject

OK. Then just make sure that the apache process has read and execute
permissions on the directory (and subdirs), and read permission on all
the files.

mralokkp

unread,
Mar 1, 2007, 2:50:57 PM3/1/07
to Django users
Still the Problem remains the same. (Gone through your suggestion).
Well I had Implemented This on Apache ( Win Based )
and Their running successfully.

On Mar 2, 12:01 am, "Jeremy Dunck" <jdu...@gmail.com> wrote:

mralokkp

unread,
Mar 1, 2007, 2:51:07 PM3/1/07
to Django users
Still the Problem remains the same. (Gone through your suggestion).
Well I had Implemented This on Apache ( Win Based )
and Their running successfully.

On Mar 2, 12:01 am, "Jeremy Dunck" <jdu...@gmail.com> wrote:

Joe Murphy

unread,
Mar 1, 2007, 4:51:52 PM3/1/07
to Django users
I've seen that error too, and fixed it by fiddling with the
PythonPath...

Malcolm Tredinnick

unread,
Mar 1, 2007, 9:58:02 PM3/1/07
to django...@googlegroups.com
On Thu, 2007-03-01 at 19:50 +0000, mralokkp wrote:
> Still the Problem remains the same. (Gone through your suggestion).
> Well I had Implemented This on Apache ( Win Based )
> and Their running successfully.

So your home directory has the execute bit set for the "other" section
as well (when you run "ls -ld /home/user", the last character of the
permissions should be 'x', the same as for the myproject directory.

Also, does /home/user/myproject/ contain an __init__.py file? I guess it
does since you seem to be saying you got it to work somewhere else, but
let's just check.

Regards,
Malcolm


Reply all
Reply to author
Forward
0 new messages