Dash config for dev qa and prod environment

Hi all,

I have an app with API endpoints that connects to a development database. But I need to have it connect to a QA database.

I currently have the API endpoints hardcoded to http://mysampleapi.com/devdata. And I will have to manually change the endpoints. So going forward I want this more dynamic.

How do you approach a config file that will easily point to any environment (Dev, QA, Prod)? What does the folder structure look like?

I heard of poetry but I don’t think that will apply.


@adamschroeder any advice?


Could you share a few words on what is your deployment environment (cloud, on-prem, Kubernates, is your app in a library, etc…)?

In the vacuum, one could arguably say that the most pythonic way to handle it is with ini files and ConfigParser, but it might not play well with the way your deployment is made.

Poetry handles python dependencies (libraries), and not really environment variables and related.

1 Like

Hi Junior,

I am using Azure App Services to deploy the dash app. My files are in Azure Repo. Im wondering if i can specify the config file in Startup Command here?

I was thinking i can set up something in my app.py file or my index.py.

Here are two links that seems helpful but Im not sure where to place the config files in a best practice manner:

I don’t have any experience with Azure Apps, but I used similar services in the past from AWS and GCP and I imagine they are related.

If it doesn’t have any “natural” way to provide enviroment variables via a configuration file (for instance Google App Engine has app.yaml where they can be set), then you are probably better setting a single environment variable with some environment alias (dev/qa/prod) or a path to the configuration file.

I would initialize the configuration file in app.py, assuming you have the typical structure where app.py is where the Dash app object is initialized. You could have the config files in a config folder in the same level as assets and `app.py, but it is your choice.

Needless to say, everything I said above assumes you can and want to version control the configuration file, so no credentials or secrets.

There might be better approaches to Azure Apps than what I just described and more informed advices, so please take it with a grain of salt. Hope this helps nonetheless! :slight_smile:


that was extremely helpful…thank you for the guidance and insight.

Much faith in the Dash Community.

And lightning fast responses!