Skip to main content

Enviroment Variables

Environment variables enhance security when sharing code. They prevent sensitive data from being exposed in your codebase. They also enable your project behavior to change based on the environment it's running in.

tip

To use environment variables on your scripts, you can use the os module in Python:

import os
os.environ.get("ENV_VAR_NAME")

The code above will work both locally and in the cloud.

Editor

The UI will create a .env file in your project root directory. You can edit this file directly in the editor or manually. This file is not shared with your codebase, so it is safe to store sensitive information there.

Cloud

When you deploy your project, the environment variables set in the editor are not automatically deployed. You must set them in the Cloud Console at the "Env Vars" tab.