Tnx for article! But there is one important caveat here: if you use Linux for example you can not use env names like HOME or NAME or LOGNAME. Because your app variables from .env file (in currently working directory) will be overwritten by the global (from Linux).
For example: in case you put in .envNAME=Michale and you are logged in as user Daniel, inside your python script os.getenv("NAME") will return Daniel instead of Michael. And most probably this is not something you want in your app....
I guess there is different ways to resolve this, but most obvious one for me is to avoid this names entirely and to use some convention like APP_NAME or APP_HOME_DIR....
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Tnx for article! But there is one important caveat here: if you use Linux for example you can not use env names like
HOMEorNAMEorLOGNAME. Because your app variables from.envfile (in currently working directory) will be overwritten by the global (from Linux).For example: in case you put in
.envNAME=Michaleand you are logged in as user Daniel, inside your python scriptos.getenv("NAME")will return Daniel instead of Michael. And most probably this is not something you want in your app....I guess there is different ways to resolve this, but most obvious one for me is to avoid this names entirely and to use some convention like
APP_NAMEorAPP_HOME_DIR....