What is the reasoning behind DJANGO_READ_DOT_ENV_FILE?
See original GitHub issueSince this commit, the .env isn’t loaded without manually setting DJANGO_READ_DOT_ENV_FILE
.
The comment states:
.env file, should load only in development environment
I don’t really agree with this since we use .env files extensively on production servers. Not a big problem as we can easily add DJANGO_READ_DOT_ENV_FILE
to the supervisor config. But I don’t understand what problem it fixes.
For local development this is a bit cumbersome. There’s no documentation explaining the need to set this variable. I’d expect it here for example.
This env variable also isn’t set in local docker config (dev.yml
), disabling the possibility to overwrite settings via a .env file.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:14 (6 by maintainers)
Top Results From Across the Web
What is the reasoning behind ...
I was just looking to see how I could use the .env file in dev automatically without needing to define the DJANGO_READ_DOT_ENV_FILE environment ......
Read more >31 - Environment Variables & dotenv - Python & Django 3.2 ...
31 - Environment Variables & dotenv - Python & Django 3.2 Tutorial SeriesTry Django 3.2 is a series to teach you the fundamentals...
Read more >environment variables - What is the use of python-dotenv?
.env is a simple text file with each environment variable listed one per line, in the format of KEY="Value". The lines starting with ......
Read more >Django - How to keep secrets safe with python-dotenv
The secret key that comes with every django project - This needs to be kept private because it's the crucial part of security...
Read more >How To Handle Environment Variables In Python - PyBites
In this article I will share 3 libraries I often use to isolate my environment variables from production code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was just looking to see how I could use the .env file in dev automatically without needing to define the DJANGO_READ_DOT_ENV_FILE environment variable. This little hack in config/settings/local.py seems to do the trick nicely. I figured it might give the next person a head start. If there is a better way please let us know.
config/settings/local.py
Replacing this package will be a lot of work. Except for some edge cases, it works okay, so why spend the effort? Also, I would rather piggy back of a package then invent something new that has to be maintained. Unless there’s a pressing need, and funds to support the reviews by core maintainers are made available, we’re not switching.
Why don’t you do the research yourself instead of asking others to volunteer their free time? Compare a dozen options for suitability, summarize the ones you think are good, and suggest the best three in a separate issue.