Bug 828632 - cobbler-web can't find django.contrib.csrf.middleware
cobbler-web can't find django.contrib.csrf.middleware
Product: Fedora
Classification: Fedora
Component: cobbler (Show other bugs)
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: James C.
Fedora Extras Quality Assurance
: 832474 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2012-06-05 01:16 EDT by Pete Travis
Modified: 2012-06-16 11:09 EDT (History)
5 users (show)

See Also:
Fixed In Version: 2.2.3-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-06 08:35:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pete Travis 2012-06-05 01:16:42 EDT
Description of problem:
Attempts to access a minimally configured instance of cobbler-web fail. The httpd error_log reports a failure to import a django-provided python module:

[Mon Jun 04 20:51:02 2012] [error] [client] mod_wsgi (pid=638): Exception occurred processing WSGI script '/usr/share/cobbler/web/cobbler.wsgi'.
[Mon Jun 04 20:51:02 2012] [error] [client] Traceback (most recent call last):
[Mon Jun 04 20:51:02 2012] [error] [client]   File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Mon Jun 04 20:51:02 2012] [error] [client]     self.load_middleware()
[Mon Jun 04 20:51:02 2012] [error] [client]   File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware
[Mon Jun 04 20:51:02 2012] [error] [client]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Mon Jun 04 20:51:02 2012] [error] [client] ImproperlyConfigured: Error importing middleware django.contrib.csrf.middleware: "No module named csrf.middleware"

Version-Release number of selected component (if applicable):

Name        : cobbler
Version     : 2.2.2
Release     : 1.fc17

Name        : cobbler-web
Version     : 2.2.2
Release     : 1.fc17

Name        : Django
Version     : 1.4
Release     : 1.fc17

Steps to Reproduce:
1. Install cobbler, cobbler-web
2. Configure cobbler
3. Access http://example.com/cobbler_web
Actual results:

httpd reports server error, fail to load required module.

Expected results:
cobbler-web can find django.contrib.csrf.middleware

Additional info:
This module was moved/renamed:
editing the MIDDLEWARE_CLASSES section of /usr/share/cobbler/web/settings.py to replace 'django.contrib.csrf.middleware.CsrfMiddleware' with 'django.middleware.csrf.CsrfViewMiddleware' will resolve this issue.
Comment 1 James C. 2012-06-06 08:35:40 EDT
This should be resolved in the current release, 2.2.3-1. As part of the new CSRF implementation, there's a conditional in the settings.py file to use the correct CSRF django library based on the django version installed.
Comment 2 James C. 2012-06-16 11:09:39 EDT
*** Bug 832474 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.