Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The SECRET_KEY setting must not be empty [duplicate]

There are three files in my settings folder:

  • base.py
  • development.py
  • production.py

I've put this line in my wsgi.py file:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproj.settings.development")

But when I run gunicorn myproj.wsgi:application and try to load application in browser I get:

ImproperlyConfigured: The SECRET_KEY setting must not be empty.

I definitely have SECRET_KEY in base.py and in development.py I have this line:

from base import *

I've updated manage.py and specified new settings file there just to test if runserver will work and it works.

UPDATE: And now I have put SECRET_KEY into development.py. When I run gunicorn myproj.wsgi:application --settings 'myproj.settings.development' the error is still there.

like image 798
Dmitrii Mikhailov Avatar asked Dec 06 '22 02:12

Dmitrii Mikhailov


1 Answers

Just needed to run :

gunicorn myproj.wsgi:application --env DJANGO_SETTINGS_MODULE='myproj.settings.development'

There's a line

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "videotube.settings.development")

in my wsgi.py. I don't know why but gunicorn doesn't care about it.

like image 199
Dmitrii Mikhailov Avatar answered Dec 10 '22 12:12

Dmitrii Mikhailov