Python for the .NET developer Transcripts
Chapter: Course conclusion
Lecture: Web apps review

Login or purchase this course to watch this video and the rest of the course contents.
0:00 The next topic we covered was
0:01 building web applications with Python
0:03 and we saw that Python was an amazing platform
0:06 for the web and tons of cool apps are built with it.
0:09 We decided to choose Flask
0:11 because it's familiar.
0:12 I've somewhat liked the ASP.NET MVC
0:15 and it's also really popular.
0:17 So, in order to do that, create a Flask web app
0:20 we're going to import Flask
0:21 and create a Flask instance, based on the name of the file.
0:25 We're going to have some main method, which runs it
0:28 could say, debugger is false
0:29 debugger is true, take your pick.
0:31 We saw also in production
0:32 that that main method doesn't get run
0:34 so you can really kind of just do you dev stuff there
0:37 then if we want to have, method a URL route
0:40 we're going to say, we're going to define
0:41 a method that is guitar list.
0:43 The name doesn't really matter
0:44 but it's going to matter to us I guess, right?
0:46 This is where we list our guitars
0:48 so we're going to add an app.route
0:50 we're going to say /guitars/variable named style.
0:54 And then notice how style is passed in guitar list
0:57 and then we just do our own implementation
0:59 we go to the guitar service
1:00 we say give us all the guitars by that style
1:02 and then we render a template guitars.html
1:05 which is a Jinja2 template
1:07 which is a dynamic way to write HTML
1:10 and then put a little bit of Python logic in there
1:12 to turn our Python data, into HTML.
1:15 That's it, besides the HTML template
1:19 really the whole app right there