Zat42 Zat42 - 20 days ago 6
Python Question

Python Django : No module named security

When I deploy my project on an Ubuntu Server, using a virtualenv, I got this error :

[17/Sep/2014 22:29:00] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/zat42/myproject/monarch/env/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 64, in __call__
return self.application(environ, start_response)
File "/home/zat42/myproject/monarch/env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__
self.load_middleware()
File "/home/zat42/myproject/monarch/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 44, in load_middleware
mw_class = import_string(middleware_path)
File "/home/zat42/myproject/monarch/env/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 26, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named security


I don't know why there is this error my configuration works fine with a fresh install... But when I copy my current project, I got Error 500. I tried to deploy "part after part" but I can't find what's wrong.

Tell me if you need more of my files because I don't really know where is the problem...

Thank you.

Answer

I met the same problem. Finnaly, I found I’m using django 1.7.1 to run a 1.8dev generated project. When I switch back to 1.7.1, and remove ‘django.middleware.security.SecurityMiddleware’ in setting.py, it seems ok.