You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<%=vars.product_short%> lets you externalize configuration - storing data such as encryption keys or external resource addresses in <ahref="../devguide/deploy-apps/environment-variable.html" target="_blank">environment variables</a>.
At runtime, environment variables are exposed to the application through its environment. You can use these for example to run your app in production mode setting the `APP_MODE` environment variable.
<preclass="terminal">
$ cf set-env my-python-app APP_MODE production
Setting env variable 'APP_MODE' to 'production' for app my-python-app in org MyOrg / space MySpace as user@smydomain.com...
OK
TIP: Use 'cf restage' to ensure your env variable changes take effect
</pre>
Then restage your app as suggested using
<preclass="terminal">
$ cf restage my-python-app
Restaging app my-python-app in org MyOrg / space MySpace as user@mydomain.com...
-----> Downloaded app package (8.0K)
-----> Downloaded app buildpack cache (2.3M)
-------> Buildpack version 1.5.4
...
</pre>
All environment variables are accessed using `os.getenv('ENV_VARIABLE')` or `os.environ('ENV_VARIABLE')` from within your Python app. Make sure you have an `import os` statement in your file to be able to use these methods.
<divstyle="text-align:center;margin:3em;">
<ahref="./bind-service.html" class="btn btn-primary">I've set my environment variable</a>