2023: conditionally import django.core.handlers.modpython?

shig****@gmai***** (Google Code) (Is this you? Claim this profile.)
March 14, 2011
> What version are you running?
1.6b1

> What's the URL of the page containing the problem?
(none yet)

> What steps will reproduce the problem?
1. rb-site install with wsgi
2. try to access reviewboard instance

> What is the expected output? What do you see instead?
Expected: reviewboard interface

Actual result: "taking a nap" page, and error_log contains:

[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40] mod_wsgi (pid=4384): Exception occurred processing WSGI script '/var/www/vhosts/review/htdocs/reviewboard.wsgi'.
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40] Traceback (most recent call last):
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40]   File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 232, in __call__
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40]     self.load_middleware()
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40]   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 42, in load_middleware
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Sat Mar 12 16:02:27 2011] [error] [client 10.20.30.40] ImproperlyConfigured: Error importing middleware reviewboard.admin.middleware: "No module named modpython"

> What operating system are you using? What browser?
Linux, Firefox

> Please provide any additional information below.
This kludge for reviewboard/admin/middleware.py helps just as fine as actually installing python-module-django-mod_python (on ALT Linux):

-from django.core.handlers.modpython import ModPythonRequest
+#from django.core.handlers.modpython import ModPythonRequest

I'd suggest making mod_python optional as per this thread:
http://groups.google.com/group/reviewboard/browse_thread/thread/fc4268453cc2d475

...or add the snippet regarding the need to install a django handler to admin docs (installation).
david
#1 david
Fixed in master (1.6) as 213cac6.
  • +Fixed
#2 shig****@gmai***** (Google Code) (Is this you? Claim this profile.)
Thanks!