0

I am running Django 1.9. on MAC

I have 2 settings files settings.py (for production) and settings_dev.py (for dev)

On my machine I run the project with ./manage.py runserver --settings=myapp.settings_dev

The problem is when I submit a form I get the Error CSRF verification failed. Request aborted.

This start happening from the time the 2 settings files got very different. For some reason when I run ./manage.py runserver --settings=myapp.settings_dev when there is a form submission Django gets settings.py.

I am sure that it is happening like that because I copy paste my DEV file in settings.py and everything runs good.

Any Idea how I can fix that issue ?

user43506
  • 155
  • 3
  • 11
  • When you print MDDLEWARE variable of your settings, 'django.middleware.csrf.CsrfViewMiddleware' is present ? Maybe you should show us your settings file. If when you copy/paste in settings.py, the project works, maybe the path to your settings file is not good. – Wilfried Jan 13 '17 at 15:30
  • If I am in dev environment I don;t care about settings.py... The issue is that Django is using it. – user43506 Jan 13 '17 at 16:04
  • A good post about multiple files settings : http://stackoverflow.com/questions/1626326/how-to-manage-local-vs-production-settings-in-django You never don't care about settings.py, it's like your base_settings, and you override it for your developpement with a dev_settings.py – Wilfried Jan 13 '17 at 16:08

0 Answers0