title: Setting and retrieving environmental variables in flask applications
body: <p>I want to build a very simple REST api using python3/flask.</p>
  
  <p>Say for example I want to set my <code>SECRET_KEY</code> required by <code>flask</code> as env var.</p>
  
  <p>What is the recommended way of going about it?</p>
  
  <p>I am aware of <code>python-dotenv</code> package that allows (or should I say <strong>requires</strong>?) the <code>.flaskenv</code> file with env vars set as key-value pairs in the form of</p>
  
  <pre><code>SECRET_KEY="my_secret_key"
  DB_NAME="mydatabase"
  </code></pre>
  
  <p>etc.</p>
  
  <p>Then (I assume) I can create a <code>settings.py</code> file such as</p>
  
  <pre><code>import os
  SECRET_KEY = os.getenv('SECRET_KEY`)
  </code></pre>
  
  <p>and then perform an <code>import settings</code> on my flask files and so on.</p>
  
  <p>My main question is how can this be adapted in a containerized environment where there will not be such an <code>.flaskenv</code> file but the respective variables will be available as runtime env vars in the container itself (say via its orchestrator)</p>
  
  <p>Will the above form of <code>settings.py</code> be able to retrieve env vars in the absence of <code>.flaskenv</code>?</p>