window 搭建osqa 运行异常
最新推荐文章于 2025-11-29 16:24:14 发布
本文记录了在Windows7系统上使用Django1.4.x版本运行开发服务器时遇到的问题及解决方案。主要错误为中间件模块django.middleware.csrf未定义CsrfResponseMiddleware类。通过降级到Django1.3.1版本成功解决了该问题。
本文记录了在Windows7系统上使用Django1.4.x版本运行开发服务器时遇到的问题及解决方案。主要错误为中间件模块django.middleware.csrf未定义CsrfResponseMiddleware类。通过降级到Django1.3.1版本成功解决了该问题。
3731
Sep 29
Irfan Haider says:
I got error when tried to run on Windows 7. Note that server is running without ...I got error when tried to run on Windows 7.
Note that server is running without any issue.
D:\osqa>manage.py runserver
Validating models...
0 errors found
Django version 1.4.1, using settings 'osqa.settings'
*Development server is running at http://127.0.0.1:8000/*
Quit the server with CTRL-BREAK.
Traceback (most recent call last):
File "D:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\contrib\staticfiles\handlers.py", line 67, in _call_
return self.application(environ, start_response)
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\wsgi.py", line 219, in _call_
self.load_middleware()
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\base.py", line 51, in load_middleware
raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class
[30/Sep/2012 02:16:52] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "D:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\contrib\staticfiles\handlers.py", line 67, in _call_
return self.application(environ, start_response)
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\wsgi.py", line 219, in _call_
self.load_middleware()
File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\base.py", line 51, in load_middleware
raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class
Solution:
Use Django version 1.3.1 and now everything is working fine (OSQA is now running on my local machine)
If you have installed latest version 1.4.x then you first you delete it and install version 1.3.1.
1. From your python site-packages directory delete django-1.4.x-pyx.x.egg
Example: D:\Python27\Lib\site-packages\django-1.4.2-py2.7.egg2. Install Django version 1.3.1 with following command
easy_install Django==1.3.1