Plotly Dash Installation Tutorial

Build Dashboards with Dash 2.0

This repo contains starter code for some of the dashboard examples provided py plotly.


Workflow

  • Install dash on your system: Dash installation tutorial

  • Download this GitHub repo to your machine (click on the green “Code” button and choose “Download Zip”)

  • On your machine: extract the files and move them to a folder of your choice.

  • Open your terminal (Anaconda prompt) and activate your conda environment dash (see step 1)

conda activate dash
  • cd into the tutorial of your choice (e.g. 01-first-app)
cd your-path-to/01-first-app
  • Execute dash with:
python app.py
  • You should get the following message in your terminal:
>Dash is running on http://127.0.0.1:8050/
>* Serving Flask app 'app' (lazy loading)
>* Environment: production
>WARNING: This is a development server. Do not use it in a production deployment.
>Use a production WSGI server instead.
>* Debug mode: on
  • In your browser (e.g. Chrome), open http://127.0.0.1:8050/

  • Dash automatically refreshes the web browser and your CSS files when you make a code change so that you don’t need to manually refresh your browser (this is called Hot Reloading). For example, make some changes to the text elements included in the app.py file and save them:

#...
children=[
          html.Div('Give me a new title', className="app-header--title")
        ]
#...    

Now take a look at the app in the browser and review the changes you have made.

  • If you are done, move to your terminal and terminate with the keyboard shortcut Ctrl+c.

Dash basics

Dash apps are saved as a app.pyfile and are composed of two parts:

  • The first part is the layout of the app and it describes what the application looks like.

  • The second part describes the interactivity of the application.

All Python code examples in this repo are meant to be saved as files and executed using python app.py. However, you can also use Jupyter with the JupyterDash library.


Resources

Avatar
Jan Kirenz
Professor

I’m a data scientist educator and consultant.

Related