Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

Run Dash Locally

Hello,

i just starting using dash as i want to build a dashboard for displaying results after analyzing students performance once they play educational games. I want the dashboard to be fully offline i.e no internet connection is required to see the dashboard and i am having difficulty in finding a way for it.

If you follow the plot.ly Dash tutorial, you’ll find that it will run locally and no internet connection is required.

Follow tutorial to create a simple app, run it locally through your terminal, put in the default local host ip and port (http://127.0.0.1:8050/) in any browser and voilá.

You have publish your app on something like Heroku or a server in order for your work to be accessible for outsiders.

Here is a link to the tutorial:
https://dash.plot.ly/getting-started

1 Like

Hi, I also need to run a dash app locally. I have found a lot of information about how to run it in “development” mode and on how to deploy it in some external server, but I haven’t found an example of how to run it in localhost but without the development options (so that the performance is optimal).

Probably that is because it is very easy to do that, but I can’t get rid of the

WARNING: This is a development server. Do not use it in a production deployment.

warning…

You could do like this:

In your main loop, make sure to specify that debug mode is false, i.e:

if __name__ == '__main__':
   app.run_server(debug=False)

, also make sure that you have declared a variable to be the Dash app server:

server = app.server  #variable name serve is just an example. name it whatever...

Then make a simple serving script using your favorite python module for this, I use the module ‘waitress’. My waitress (serving) script looks like this (lets name the script ‘server.py’:

from waitress import serve   #import the serve function of waitress
from app import server       #import the "server" part of the Dash app from my main script, which is named app.py

serve(server)                #use waitress as server

Then, by running python server.py you will not be in development mode, but see something like:

waitress example

Punching whatever URL you get into your favorite browser™ will get you your dash application.

I am not the expert to explain the difference. I know that it is something along that the Dash library has a built-in Flask function such that with you simply python app.py without further ado, a small server environment is created to launch the app. This is what is called the Development server i think.