Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Databricks automatically sets several environment variables in the app runtime environment. These variables provide essential information about the app and workspace and are accessible to all Databricks apps by default.
If your app requires additional environment variables, define them in the app.yaml configuration file in the env
section. Each variable requires a name and a value.
Default environment variables
The following default environment variables are available to every app:
Variable | Description |
---|---|
DATABRICKS_APP_NAME |
The name of the running app. |
DATABRICKS_WORKSPACE_ID |
The unique ID for the Databricks workspace the app belongs to. |
DATABRICKS_HOST |
The URL of the Databricks workspace to which the app belongs. |
DATABRICKS_APP_PORT |
The network port the app should listen on. |
DATABRICKS_CLIENT_ID |
The client ID for the Databricks service principal assigned to the app. |
DATABRICKS_CLIENT_SECRET |
The OAuth secret for the Databricks service principal assigned to the app. |
Default environment variables for Streamlit
If you use the Streamlit framework, the Databricks Apps environment pre-configures several Streamlit-specific environment variables:
Variable | Description |
---|---|
STREAMLIT_SERVER_ADDRESS |
The server address for use by Streamlit. This value is set to 0.0.0.0 and must not be overridden. |
STREAMLIT_SERVER_PORT |
The port for use by Streamlit. This value is set to DATABRICKS_APP_PORT and must not be overridden. |
STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION |
Because the Databricks Apps reverse proxy protects against Cross-Site Request Forgery (XSRF), this is set to false . |
STREAMLIT_SERVER_ENABLE_CORS |
Because the Databricks Apps reverse proxy protects against Cross-Origin Resource Sharing (CORS), This is set to false . |
STREAMLIT_SERVER_HEADLESS |
This is set to true so Streamlit runs without opening a browser window when starting. |
STREAMLIT_BROWSER_GATHER_USAGE_STATS |
This is set to false to prevent sending user stats to Streamlit. |