django-environ icon indicating copy to clipboard operation
django-environ copied to clipboard

Remove "filthy magic stack backtracking" in favor of BASE_DIR

Open birdcar opened this issue 4 years ago • 5 comments

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

birdcar avatar Mar 19 '20 08:03 birdcar

PR was closed by mistake. Reopened it.

sergeyklay avatar Sep 04 '21 14:09 sergeyklay

Coverage Status

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.

coveralls avatar Sep 06 '21 08:09 coveralls

@sergeyklay is it possible to change the merge target of this PR to be main ?

jayvdb avatar Apr 13 '22 05:04 jayvdb

@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.

sergeyklay avatar Jun 13 '22 20:06 sergeyklay

No worries. At the time I wrote that, there was no develop branch.

jayvdb avatar Jun 13 '22 23:06 jayvdb