So we have already created a model and added a handler to our todo app. If you haven't done this so far just follow the links. It also just takes a few minutes to set this all up. Cause this is the idea of PythonOnWheels, to make the basic things as easy as possible to focus on the app, not on the boilerplate.
We are now at the frontend part. This is the views part in the terminology of MVC structured apps. As usual in PythonOnWheels we use a generator to create the scaffolding of a web frontend for us. Just as for the handler the convention is that the generator will produce views for the typical REST routes we just created in our handler. As of today PoW supports bootstrap 4 and semanticUI as frontend frameworks. Bootstrap 4 is the default.
To create a scaffolded view you execute the generate_scaffold.py generator and give it the handler name it should link to with -n handler_name and the view-type it should generate with -t bs4 (for bootstrap 4 or sui for semanticUI). So execute this to generate a whole set of views for all our REST methods.
python generate_scaffold.py -n todo -t bs4And you should see the following result:
You can see that generate_scaffold created five views for us. Namely show, list, page, edit and new. We also get delete as a functionality on the list view as you will see but since this "only" deletes there is just a button for that and no dedicated view.
What you can see in the screenshot above is the list view. You can access it with the REST route:
This is the main entry point to manage our data. From here you can create, show, edit and delete data. So all the CRUD functions are available right here.
You have come pretty far. You have created a model, added a handler, and now you also added a complete web frontend. And all this without any configuration, installation, setups or any boilerplate. Just right there to your app. What has been created for you is just based on the standard libraries below PoW. Like Tocrnado, sqlalchemy and so forth. So you can now adapt your app to your need. Most probably you will add some handler methods to do custom things with your data. And you will adapt the views or create new views to make your app look beautiful and enhance usability. The scaffolding is more ment for developers to get an easy (and nice) access to your handler and models.
Your client (most probably a browser) will sen a request to your app (the PythonOnWheels server). The right handler is invoked with the right method for that request (depending on the route). It handles the data (CRUD) and returns a result. We saw already that when we request json, we get json. And if we request HTML (as all browsers do by default) we get HTML back. That's our views.