Puzzling error in Django .96 site

0 views
Skip to first unread message

Sydney Weidman

unread,
Nov 6, 2009, 1:40:47 PM11/6/09
to Django users
I have a Django .96 site deployed in RHEL4 running under Linux with
Python 2.3.4. When I try to visit any app, I get the following error
message:

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

Traceback (most recent call last):

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

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

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

File "/usr/lib/python2.3/site-packages/django/core/handlers/
base.py", line 35, in load_middleware
raise exceptions.ImproperlyConfigured, 'Middleware module "%s"
does not define a "%s" class' % (mw_module, mw_classname)

ImproperlyConfigured: Middleware module
"django.contrib.sessions.middleware" does not define a
"SessionMiddleware" class

and yet I can run:

[example@foo classics]$ python manage.py shell
Python 2.3.4 (#1, Jul 16 2009, 07:01:37)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.sessions.middleware import SessionMiddleware
>>>


Here is my apache config for the virtual host:

<VirtualHost *:80>
ServerName foo.bar.com
ServerAdmin exa...@bar.com
DocumentRoot /var/www/django/classicsdocs
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE classics.settings
PythonPath "['/var/www/django'] + sys.path"
PythonDebug On
</Location>
<Location "/iamedia/">
SetHandler None
</Location>
<Location "/media/">
SetHandler None
</Location>
ErrorLog /var/log/httpd/foo.bar.com-error_log
CustomLog /var/log/httpd/foo.bar.com-access_log combined
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* -[F]
</VirtualHost>


Any ideas what I might be doing wrong?

Sydney Weidman

unread,
Nov 6, 2009, 1:48:01 PM11/6/09
to Django users
D'oh -- it was a problem with SELinux context not being set properly
on some of the files.

Never mind...
Reply all
Reply to author
Forward
0 new messages