Anvil: Web Apps with Nothing but Python Transcripts
Chapter: Welcome to the course
Lecture: What we will cover
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Hello and welcome to our course Anvil Web Apps with Nothing but Python. Have you ever wanted to create a web app?
0:07
But then as you got into it you realized well, it's not just Python it's also CSS, HTML, JavaScript, server-side code
0:16
maybe Docker or Linux and then talking to a database with something like SQL, and database design and all of these things.
0:23
Well, building real web apps that are what you might call full stack web app there are a ton of moving parts there. A bunch of different technologies.
0:32
I like to say that you need to know at least five different technologies, programming languages to work on full stack web apps.
0:39
But, with Anvil, all you need to know is how to work with a visual designer and write Python code.
0:44
And they make that Python code take care of everything. The front-end JavaScript-type stuff as well as the backend server stuff.
0:51
They have the database in place and it already has the relationships defined for you. What we will be covering in this course? Well, let's see.
0:58
We're going to start out talking a little bit about full stack development. As we kind of already have.
1:03
We're going to dig into what it is and we'll refer back to that as we go throughout the course. What we're doing is taking a simplified layer
1:11
on top of a full stack development experience. Anvil handles a lot of the details of piecing things together and putting them in place for us so
1:18
we don't have to worry about them but it's always good to know what full stack is and how it fits into our world.
1:24
When we build websites, we want to create web pages so we can show them in our browser. Now, how do you go about doing that?
1:31
Normally, what you might do is go and open up a blank file and start typing in HTML maybe put in some CSS and some content.
1:39
You got to know quite a bit to make that work well. Yes, you can type a div or a button into an HTML page
1:45
and make that work, but what if you really want a cool, interactive page, that is laid out just so? You need to know a lot of web design.
1:54
With Anvil, you get a visual designer, with a toolbox full of these controls. You can drag a button over and drop it
2:01
and sets some properties on it to make it look just like I want. I can get a calendar component or a chart position these all just right on the page
2:10
and then I can even hook into events that are happening on say to that calendar. Like I can change the way the page looks
2:17
by hooking into the event of date changed on that calendar. This makes it much, much easier to build interactive pages mostly working with data.
2:25
We're not talking about just pure documentation but I've got some sort of data on the page and I want to put it into some sort of controls
2:31
and interact with it. This visual form designer is the primary way to create web pages in Anvil.
2:37
And you'll see that it works really well for that use case. We also going to talk about navigation between pages. You might be thinking
2:45
Michael, that's just put a hyperlink here and it's going to click over to another page and that's navigation on the web. Yes, in general that's true
2:54
but within Anvil apps, it's a little bit different. These are what are called single page applications sometimes referred to as SPAs.
3:02
As far as the browser's concerned it downloads the page once and once it's loaded up, it never refreshes the page.
3:08
Just a bunch of JavaScripty stuff is happening. It happens to be that the JavaScript is reloading parts of the UI
3:14
so to the user, it looks like you're going from screen to screen to screen but you're not doing that by navigating the browser away with a hyperlink.
3:21
You're navigating that by swapping out elements and part of your UI. And it's not hard, but it's a little bit different
3:27
and we're going to focus on how to do that. You see, it's really nice because there's actually no latency. You're not going to the server
3:34
and waiting for a response and then loading the page. You're just running locally. It doesn't really even matter what network
3:40
or how fast your network is. So, this navigation is pretty cool. We're going to talk about databases.
3:45
Now, we don't have to set up databases, or design them or create them with DDL and all that kind of stuff that maybe you don't want to think about
3:52
but there is a database service and we can create tables that already can easily have relationships between them through the
4:00
super simplified view into a database called Data Tables and we're going to use that to store a bunch of information.
4:06
We're going to have what are called client modules. Because our application is a single page app, a lot
4:13
of stuff is happening on the client in JavaScript. However, we don't want to write JavaScript. We're Python people, right?
4:21
With these client modules, as well as the forms we write Python code. That Python code runs in the browser. Incredibly, in Anvil, you write Python code
4:32
instead of JavaScript to run on the front end. That's super awesome. Sometimes you have to write server-side code as well.
4:39
Server-side code can run with higher access to the database, or it runs on real Python with access to the real packages and modules that
4:47
you might need to do real Python things and keep them save on the server where nobody can mess with them. So, we'll be able to define client modules
4:55
and server-side modules and connect them together basically seamlessly. Anvil has a really great way to do that.
5:00
You don't have to think about creating services to communicate back and forth between them.
5:05
We're going to manage users and store those in our database. We do have a database and we could just create a table where we store user information
5:12
but Anvil has a special user service with cool integration into things like single sign-on or Google logins, or, you know, storing
5:20
your user account successfully without incorrectly storing their password and accidentally leaking that.
5:26
Things like this. So, user service is really nice. With something like Anvil, you might think you're stuck in this web world with the designer
5:34
but a lot of cool web applications can be way more than just a web app if they define an API. If they have some kind of HTTP service that other things
5:43
like mobile apps or other web applications can integrate with. And Anvil does that as well. We're going to focus a lot on building HTTP services
5:52
with Anvil and consuming them. We're even build a Python, GUI-based application, running locally, talking to and working with our data
6:00
over this HTTP service that we're going to create in Anvil. Speaking of which, we're going to create this client application and it's going to be
6:07
the thing that actually talks to our HTTP service. In the app that we're going to build we're going to model some kind of paid
6:14
software as a service product and, in order to that we're going to have to let our users buy a pro version of our service.
6:22
We're going to add e-commerce support with Stripe to our web app and you'll see that's actually super doable.
6:29
So, ultimately, if you're going to have a product it's needs its own domain. You don't want to just put it out and leave it on some
6:36
kind of random, shareable link. If you've got something like Google you want it at google.com. If you've got something like Talk Python, you want it at
6:44
talkPython.com or .fm or wherever it happens to be. We'll see that we can take our Anvil app and host it on a custom domain that we control.
6:55
And finally, we'll see there's some limited support for version control. Not entire direct Git or Subversion or something like that
7:02
but there is definitely version control for our web applications and we're going to use that. We're also going to have a GITHub app repository
7:09
where we give you all the code that we write in this course.