4/11/23, 1:07 PM A Minimal Dash App | Dash for Python Documentation | Plotly
Star 18,468
Python
Dash Python > A Minimal Dash App
A Minimal Dash App
A minimal Dash app will typically look like this:
from dash import Dash, html, dcc, callback, Output, Input
import [Link] as px
import pandas as pd
df = pd.read_csv('[Link]
app = Dash(__name__)
[Link] = [Link]([
html.H1(children='Title of Dash App', style={'textAlign':'center'}),
[Link]([Link](), 'Canada', id='dropdown-selection'),
[Link](id='graph-content')
])
@callback(
Output('graph-content', 'figure'),
Input('dropdown-selection', 'value')
)
def update_graph(value):
dff = df[[Link]==value]
return [Link](dff, x='year', y='pop')
if __name__ == '__main__':
app.run_server(debug=True)
Title of Dash App
Canada
×
30M
[Link] 1/3
4/11/23, 1:07 PM A Minimal Dash App | Dash for Python Documentation | Plotly
25M
pop
20M
15M
1950 1960 1970 1980 19
year
To run the app, copy the above code into a new file named [Link] and type into your terminal
the command python [Link] . Then, go to the http link.
Dash is running on [Link]
* 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
* Running on [Link] (Press CTRL+C to quit)
The next section will cover the main elements of a Dash app. Dash in 20 minutes tutorial!
These docs are a Dash app running on Dash Enterprise on Azure Kubernetes Service.
Write, deploy, and scale Dash apps on a Dash Enterprise Kubernetes cluster.
Learn More | Pricing | Dash Enterprise Demo | Dash Enterprise Overview
Dash Python > A Minimal Dash App
Products Pricing About Us Support Join our mailing
Dash Enterprise Pricing Careers Community Support list
Consulting and Training Resources Graphing Documentation
Sign up to stay in the
Blog
loop with all things Plotly
— from Dash Club to
product updates,
webinars, and more!
[Link] 2/3
4/11/23, 1:07 PM A Minimal Dash App | Dash for Python Documentation | Plotly
SUBSCRIBE
Copyright © 2023 Plotly. All rights reserved. Privacy Policy
[Link] 3/3