#100DaysOfCode in Python Transcripts
Chapter: Days 85-87: Fullstack web apps made easy
Lecture: Anvil concepts

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's review some of the core concepts around Anvil. We saw that we start be defining these forms.
0:06 We drag the components over, we set their properties, their names, their bindings, all that kinds of stuff.
0:10 Here's our add document UI and we also have the code, so on the flip side we could look at the code behind in the form
0:18 and hook into the events for like the button click or link click or page load or this thing shown all sorts of cool tuff.
0:26 And this Python code is actually converted into Javascript and runs on the client side. So all the code you write here
0:33 doesn't ever touch your server at all. It's just, we write it in Python but it actually runs locally which is actually really amazing
0:40 and takes a lot of the load off your server. One thing we wanted to do was navigate between sub forms, so to load a different sub form
0:48 but effectively in this case navigate the home_details_form. We go to the content panel and clear out whatever happens to be there
0:55 and then we add a new instance of the sub form that we want to show. Sometimes it's parameterless like this one, other times like our document details
1:03 we actually passed in the particular document that was selected and then it showed the details of that.
1:09 It's a really really nice way to navigate between these. Of course you're going to likely need a database. You can go to the data table service
1:18 and create these tables and fill them up with data. It's really easy, you can even link between them. Don't forget to set the permissions,
1:24 in this example it's no access from Javascript but on the server side there is access. To do that server side code,
1:32 we're going to write a server module and make it callable back on the client so here we created all docs method and we added a callable decorator,
1:41 we just write whatever code we want and return it and this magically finds its way back linked in with all sorts of auto complete
1:47 in various places back on the client side code. Speaking of client side code, here's a little bit of our refresh data
1:54 we just say anvil.server.call and we type in the name and then we put in the perimeters if they're more after that.
2:00 Now we just work with the documents, right? So it's just a list of dictionary's, off we go. Once you get your app built,
2:06 you want to put it on the internet. It's so amazing. So you can click publish and it pulls up either a little trial link,
2:12 you want to try the mobile version on your phone or I clicked share via public link. We also saw that there's version history
2:20 which is really nice, you can clone that with git but what's relevant here is you can click publish at the different save points.
2:27 So you name these like to present, that's one I named and if for some reason you make a new change you don't like it
2:32 just go click publish and instantly roll it back to an old version. Really awesome, right there.
2:38 Finally, if you want to get the whole story, the back story on Anvil, I had Meredydd Luff on Talk Python on Episode 138 and we talk about all the
2:45 internal workings of how this is built, how he makes all the pieces work together and it's pretty cool. So if you enjoyed this and want to learn more,
2:53 check out that episode of Talk Python.


Talk Python's Mastodon Michael Kennedy's Mastodon