Bug 828632

Summary: cobbler-web can't find django.contrib.csrf.middleware
Product: [Fedora] Fedora Reporter: Pete Travis <me>
Component: cobblerAssignee: James C. <jimi>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: awood, christian.gonzalez, dgoodwin, jimi, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 2.2.3-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-06 12:35:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pete Travis 2012-06-05 05:16:42 UTC
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 10.0.0.183] mod_wsgi (pid=638): Exception occurred processing WSGI script '/usr/share/cobbler/web/cobbler.wsgi'.
[Mon Jun 04 20:51:02 2012] [error] [client 10.0.0.183] Traceback (most recent call last):
[Mon Jun 04 20:51:02 2012] [error] [client 10.0.0.183]   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 10.0.0.183]     self.load_middleware()
[Mon Jun 04 20:51:02 2012] [error] [client 10.0.0.183]   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 10.0.0.183]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Mon Jun 04 20:51:02 2012] [error] [client 10.0.0.183] 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 12:35:40 UTC
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 15:09:39 UTC
*** Bug 832474 has been marked as a duplicate of this bug. ***