尝试在 django 中运行此中间件时遇到此错误。https://github.com/shanx/django-maintenancemode
它正在返回一个
AttributeError: 'module' object has no attribute '__all__'.
我做错了什么吗?我正在尝试在 virtualenv 中的本地主机环境中测试他。我已将中间件放入设置文件中,无论我将模式设置为 true 还是 false,都会返回此错误。我在我希望它提供服务的模板文件夹中放置了一个 503.html 模板。
追溯
Traceback (most recent call last):
File "C:\python27\Lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\contrib\staticfiles\handlers.py", line 72, in __call__
return self.application(environ, start_response)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\core\handlers\wsgi.py", line 236, in __call__
self.load_middleware()
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\core\handlers\base.py", line 51, in load_middleware
mod = import_module(mw_module)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django_maintenancemode-0.9.3-py2.7.egg\maintenancemode\middleware.py", line 6, in <module>
defaults.__all__.append('handler503')
AttributeError: 'module' object has no attribute '__all__'
[11/Jul/2013 14:57:57] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "C:\python27\Lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\contrib\staticfiles\handlers.py", line 72, in __call__
return self.application(environ, start_response)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\core\handlers\wsgi.py", line 236, in __call__
self.load_middleware()
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\core\handlers\base.py", line 51, in load_middleware
mod = import_module(mw_module)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Users\Deep.C\.virtualenvs\dcwebdev\lib\site-packages\django_maintenancemode-0.9.3-py2.7.egg\maintenancemode\middleware.py", line 6, in <module>
defaults.__all__.append('handler503')
AttributeError: 'module' object has no attribute '__all__'