New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does not load env variables from the .env file #76
Comments
Solved it. The .env needs to be in the same folder as the settings files, not the manage.py file. Confusing as in the the Django Cookiecutter the env.example file is in the manage.py folder... |
@musicformellons Would you mind sharing what your settings.py looks like? I'm having this issue and can't work it out |
I was having some problems with this too, but after specifying in settings.py the absolute path to where I keep my
|
Modified this bit more so that if
|
I have a PR to add ability to point to a env file via environment variable. |
Guys 🤦♂️ Removing spaces solved the problem: |
But I still have the issue |
I have an .env file (in same folder as manage.py) with:
DJANGO_DEBUG=False
DATABASE_URL=postgres://user:pw@127.0.0.1:5432/dbname
POSTGRES_PASSWORD=pw
POSTGRES_USER=user
DJANGO_ADMIN_URL=r'^admin/'
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=7878078078078907890789087etc
DJANGO_ALLOWED_HOSTS=email.com
DJANGO_SERVER_EMAIL=info@email.com
DJANGO_SECURE_SSL_REDIRECT=False
But when I do:
python manage.py migrate --settings config.settings.production
I get:
django.core.exceptions.ImproperlyConfigured: Set the DJANGO_SECRET_KEY environment variable
Also env does not show any of the variables. The variables should have been loaded from my .env file right? So what's wrong?
BTW: I think the docs could be clearer on where to put the .env file and that is is loaded and when, I suppose. I looked elsewhere to find that that was indeed to be expected.
The text was updated successfully, but these errors were encountered: