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