HTMX + Flask: Modern Python Web Apps, Hold the JavaScript Transcripts
Chapter: Surveying the non-js-enabled Flask app
Lecture: Concept: Code organization

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We saw the pieces of code that we're working with. We saw the models and the views, and we even saw some few models stuff.
0:07 But I want to highlight a little bit more organization than we've seen so far. So over in our project structure. We have a couple of things.
0:16 We have our View models and notice the View models have a home folder. And in there we have the index_viewmodel.
0:24 So here in the views we have a home file and an index method. Both the folder structure and the view models as well as the name of the file
0:33 have a direct correlation. So if you're in that index_viewmodel and the home folder, well what does it apply to? the home set of views and the index
0:42 method. Also, it derives from the ViewModelBase in shared. Everyone's going to be sharing that. No one really directly uses that.
0:51 Just like the view models have a sub structure that matches the view and method name
0:56 So do our templates. So we have our template folder which again has a home folder because that has to do with the home views and the
1:04 there. And we have a method called index. So we have an HTML file called index.html. So this helps us know if we're in one section.
1:13 If we're working in HTML. What is its view model? What is its actual view implementation? You can use these two steps.
1:20 What is the name of the view file or collection? home and what is the name of the method? index. And that will help you quickly know where the various
1:29 pieces go. So this is how I've organized everything.

Talk Python's Mastodon Michael Kennedy's Mastodon