django-environ
django-environ copied to clipboard
Remove "filthy magic stack backtracking" in favor of BASE_DIR
The read_env
documentation currently states:
If not given a path to a dotenv path, does filthy magic stack backtracking to find manage.py and then find the dotenv.
Based on joke2k/django-environ#88, it appears that this behavior is rather fragile.
To improve this, I think the package should document that read_env expects you to provide a path. If one is not provided, it will attempt to use the BASE_DIR constant from the django settings module. If an ImportError is encountered while it attempts to do this, read_env will assume there's no .env file to be found, log an info message to that effect, and continue on.
fixes: joke2k/django-environ#88
PR was closed by mistake. Reopened it.
Coverage decreased (-0.2%) to 89.732% when pulling 05de2584fabe4c023a59037a21acaf15f0b01771 on birdcar:@nickcannariato-refactor-blank-read-env-import-and-docs into d43ffd5e93fe5c41ade6cf698dd0eeee187ec483 on joke2k:develop.
@sergeyklay is it possible to change the merge target of this PR to be main
?
@jayvdb Usually we merge changes to the develop
branch. Then, before a release, we merge the develop
branch into the main
and make a release from the main
branch.
No worries. At the time I wrote that, there was no develop
branch.