Here I have used django-environ to set the environment variable but it is giving me SECRET_KEY error.How to properly configure the environmental variable?
I also used the python-decouple for this instead of django-environ which works fine but didn't work with django-environ.
What is the difference between django-environ and python-decouple which will be the best for this ?
settings
import environ
env = environ.Env()
SECRET_KEY = env('SECRET_KEY')
DEBUG = env.bool("DEBUG", False)
.env file
DEBUG = True
SECRET_KEY = #qoh86ptbe51lg0o#!v1#h(t+g&!4_v7f!ovsl^58bo)g4hqkq #this is the django gives
Got this exception while using django-environ
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable
django-environworks fine, but you need to load the.envfile – just instantiating anEnvdoes not do that:In addition, I've found it an useful idiom to have "sane defaults" based on the DEBUG value (which must only be true when developing):
Setting
Env.NOTSETas the default will have django-environ complain for unset values.