title: cannot get environment variables set in Flask application
body: <p>I tried to set up sensitive information as environment variables in CentOS, and pass them to Flask config file used in main file, i.e.  <strong>init</strong>.py . But it did not work.  The Flask application is running under Apache.</p>
  
  <p>I first edit /etc/environment as root user</p>
  
  <pre><code>MAIL_USERNAME="abcde@abc.com"
  </code></pre>
  
  <p>then logout, login again
  Then verify MAIL_USERNAME is set by running </p>
  
  <pre><code>echo $MAIL_USERNAME
  </code></pre>
  
  <p>This works fine</p>
  
  <p>And in configuration.py, this is how I set MAIL_USERNAME.</p>
  
  <pre><code>MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
  </code></pre>
  
  <p>for testing purpose,
  I print out MAIL_USERNAME</p>
  
  <pre><code>in __init__.py
  print(MAIL_USERNAME)
  </code></pre>
  
  <p>Then from terminal, if I run </p>
  
  <pre><code>python3.4 __init__.py
  </code></pre>
  
  <p>it print out correct values of MAIL_USERNAME</p>
  
  <p>However, if I tested on web browser,   MAIL_USERNAME is just not set. it shows NONE. I verify this by looking Apache log.</p>
  
  <p>Any idea of how this works would be really appreciated.</p>
  
  <p>Thanks</p>