I have written a script, just tested on my local, moved to dev, did not work because of url/environment variable. I need to add the correct location of the file that is being created.
how do i tell which env i am in using the os library in python?
```/mnt/www/html/**warkdev**/docroot - for dev```
/mnt/www/html/**warkstg**/docroot - for staging
```/mnt/www/html/**wark**/docroot - for prod```
I am testing out
os.getcwd
, but that is giving the entire url, and i don't want to start slicing up, How can i get the envir vars info via os so i can tell if I am in stg, dev, prod?
Thank you in advance.
CodePudding user response:
For those with the same question in the future, use print(os.environ). look for the key/pair that you need then
someVar = os.environ['SITE_NAME']