Page Routing

Learn how to modify the application in a way that it should only render the view if the provided route is valid.

About the application

We’ll look at some modifications in our main app.py module. This module is required to only render certain UI components when the route is valid. In case of any invalid route, the application will not get rendered and will show the user an error message along with a link that will redirect the user to the landing page.

This is what the application looks like:

Note: To log in, use the username admin and password 123.

Copyright (c) 2020 John Sheehan

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Handling routes in the app.py file

Final modifications in the app

...