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
(myvenv) pip uninstall django==(version)
(myenv) pip install django==(version)
Just it.
I ran into this same problem. It turned out that I was inadvertently using my machine's version of django-admin.py to start my Django project, rather than the one installed within the virtualenv. I ended up having to source bin/activate
again after installing django within the virtualenv, before running any of the django-admin commands.
use this it worked for me
MIDDLEWARE_CLASSES = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
So, I found a solution :
'django.middleware.security.SecurityMiddleware'
This line is in MIDDLEWARE_CLASSES, from settings.py. When I delete this line I have no more problems with the security module but I guess this is not a good way to solve the problem ... I guess this line is in relation with the crsf token and things like that.
Any other idea to fix the problem ?
I had the same problem when switching my project from another pc. As i didn't like very much the option given to remove the
'django.middleware.security.SecurityMiddleware'
I just created a new project and a new app, change the settings by hand and copy the rest of the files, and it worked :)
I'm guessing it has something to do with the secretkey of the project.
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.