Python Data Visualization Transcripts
Chapter: Dash
Lecture: Running app
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Now we're gonna go back to our command line and I have already installed dash. So to run the file, I use python and then the name of the file
0:10
So we call it dash simple app and you'll notice that this is different than streamlit and streamlit. We had a specific streamlit run command here,
0:22
we use the python, just standard interpreter to run that file and that's why we had to do the if underscore double,
0:30
underscore name equals main so that it knows when this file is run to serve up
0:36
the dash flask app. So you'll get this description here that we're running our dash app. This is with debug mode on and this is only what you should do
0:46
kind of in a safe environment where you're doing development, production, deployment is something that's a little outside of the scope so you can see
0:54
now that dash is running at this URL. I'm gonna copy that now. Let's take a look. I'll hit the refresh on that.
1:02
So now we have our dash app which has the histogram and it's running on the local server. So this has all of the functionality of plotly express that
1:15
We've seen there's also this button down here that gives you a little bit more information about the errors that maybe you see the server information.
1:22
So that's put here by dash. And so I'll put a side by side. So let's take a look at this side by side so that we understand exactly everything
1:32
that's going on. We talked about our imports. Notice how we say the apps name here. That's just for the internal running of the file.
1:41
When we set up the flask app we have our histogram which looks very similar to the history as we've used before and now we have our layout.
1:48
So I want to walk through this. The heading is simple histogram. You see that here. The div is behind the scenes.
1:56
You can't see that but it does have a label and calls it annual fuel cost plot. And then I tell it the graph goes here and then behind the scenes
2:05
we saw it run and have that debug equals True. So this is your basic dash app that will serve up a simple histogram
2:15
will show how to add more interactive elements to it in a moment.