Environment variables#
If your application requires environment variables, you can define them when deploying it. To expand the section click on the triangle to the left:
Then, add the environment variables keys and values:
To add more, click on the button to the right:
Reading variables#
To read the variables, use the following Python code:
from os import environ
value = environ.get("MY_ENV_VAR")
if value is None:
print("MY_ENV_VAR is undefined!")
else:
print(f"MY_ENV_VAR: {value}")
A complete example is available here.