Skip to main content

Env Vars

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.

Using on the Editor

Use the "Env Vars" tab on the editor. Environment variables set locally are not automatically deployed with your project files. You must separately set production environment variables in the console.

The UI will create a .env file in your project root directory. You may also create this file manually.

info

Always restart your development server whenever an environment variable is updated to ensure consistency.

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.

Using in the Cloud

Access the Cloud Console and the "Env Vars" tab. Set the environment variables you want your project to use in production.