#100DaysOfWeb in Python Transcripts
Chapter: Day 52: Anvil - Full Stack Web Apps
Lecture: Anvil's building blocks
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Before we start building our application with Anvil, lets look at the building blocks, all the pieces,
0:05
the little Lego bricks that we have to put together because they're really easy to fit together and use. So, let's do a quick survey.
0:13
Probably the first thing you'll notice is forms. And forms are the HTML pages and components. You have a nice visual designer with a set of components
0:21
you can drag over and visually line up and click on them and set their properties and so on. So, that's really nice.
0:26
There's also a code behind thing that goes with them that you can run some code as part of interacting with the form.
0:34
Now, some code doesn't belong within the UI, it belongs elsewhere. Maybe it's shared across forms or it just doesn't really
0:40
belong there and so, that would be in this client module section. So here you can create these Python modules that you write
0:46
arbitrary Python code that can be called from within the forms, can interact with each other and so on.
0:51
So, it's kind of a nice way to separate stuff out there. We'll also have server modules. So, this client code in the form code behind
0:59
actually runs on the client side. Think about that for a minute. Python code running a client side. That means in the browser, so it actually converts
1:07
to JavaScript and runs there. Sometimes you need code to run on the server to interact with your database in certain ways or to work with secrets,
1:15
or validate stuff that nobody can mess with. So, that's server modules. And there's nice integration here. And of course you need data, a database.
1:22
So there's this concept of data tables which is really nice and easy and integrated. On top of these four things we have services.
1:29
So, things like user management, storing users with passwords and registration and stuff like that.
1:36
Secrets like API keys you don't want to put in your code but still make accessible to your web app. And Google and Facebook APIs,
1:41
so if you want to get to say like Google Drive, for example. Stripe if you want to accept payments. And finally, this thing called uplink.
1:48
Now, uplink, we talked about a thing called uplink, a Python package for services but this is not that. Put these entirely out of your mind
1:56
they're totally unrelated. This is just the same name they have here as the thing that we played with earlier.
2:01
The idea is, if you would like your web application to reach out and get inside some other thing and interact with it
2:10
you can do this thing called uplink. Here's an example. Suppose I have a Raspberry Pi that's running some Python code that controls my house.
2:17
Inside that Raspberry Pi, I don't want to have a service that things integrate with but I would, somehow, like my
2:24
web application to initiate a call into that Raspberry Pi. Like, let's say to turn on the lights or
2:30
open the garage door by clicking a button on my web app. Uplink would make that happen. So, really, really cool. We're not going to use it at all.
2:36
We're not going to use any of these services for what we're doing but we are going to work with the top four items for sure.