question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation for read_env()

See original GitHub issue

The readme briefly mentions read_env(), however it wasn’t until reading the source that the following became apparent:

  • that the values read in from the .env file are overridden by any that already existed in the environment (I think this is handy, but isn’t immediately obvious)
  • that read_env() also takes an overrides list
  • that read_env() updates os.environ directly, rather than just that particular Env instance (someone not realising this was intentional is what caused #66 to be filed)

It would be great to mention the above in the readme. If I get a chance to open a PR I will, but it may not be soon, so if anyone wants to do so in the meantime, go ahead 😃

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

6reactions
bittnercommented, Nov 26, 2016

Also, the documentation mentions a “filthy magic stack backtracking” in order to “find manage.py and then find the dotenv”.

It should be specified more in detail what this means. When you have a two-level hierarchy then the .env file is not found, at the moment. It’s yet to be discussed whether this is by design or a bug.

mysite
+-- mysite
|   +-- settings.py
+-- .env               # not found by Env.read_env() in mysite.settings
2reactions
bittnercommented, May 21, 2019

I’d suggest to use os.path.join(base, ".env") instead of a slash in a string. The former is OS independent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Variables - The U-Boot Documentation
U-Boot supports user configuration using environment variables which can be made persistent by saving to persistent storage, for example flash memory.
Read more >
python-dotenv - GitHub
Reads key-value pairs from a .env file and can set them as environment variables. It helps in developing applications following the 12-factor principles....
Read more >
Local Dev Environment Variable Tutorial - Enhance docs
Create an API Route to read env vars. API Routes are a Node.js process; process.env lists all environment variables. app/api/debug.
Read more >
python-dotenv - PyPI
python-dotenv. Build Status PyPI version. Python-dotenv reads key-value pairs from a .env file and can set them as environment variables.
Read more >
How to help improve kernel documentation
This guide is for contributors who would like to improve that situation. ... Resource-managed devfreq_register_notifier() * @dev: The devfreq user device.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found