I’m deploying my app to three different environments (test, acceptance, production). Depending on the environment, the Docker container running the app has different values for the DASH_DEBUG environment variable.
It seems this value is not recognised when launching the app with gunicorn.
Testing locally, this issue is confirmed. First I set the environment variable: export DASH_DEBUG='true'.
Then if I do uv run app.py the app displays the debug interface.
However, if I do uv run gunicorn --bind 0.0.0.0:8050 app:server the app does not display the debug interface.
How can I make it so the environment variable is recognised when launching with gunicorn?
Relevant code snippets:
import dash
...
app = dash.Dash(title='app_title')
# For gunicorn
server = app.server
...
if __name__ == "__main__":
app.run(host="0.0.0.0")