Forums

cannot set environment variables for virtualenv using source command

command:

$ source conf/defaults.env

where, defaults.env has following content:

export BIOSTAR_HOME=pwd
export BIOSTAR_HOSTNAME="localhost:8080"

but cant retrieve value of these environment variables in my base.py

import os

os.environ["BIOSTAR_HOME"] cant retrieve

Are you running Python in the same Bash console that you ran the "source" command in?

If you're trying to get environment variables into your web apps, check out this guide: http://help.pythonanywhere.com/pages/environment-variables-for-web-apps