URL Routes and Views

In this lesson, we will get to know what views are, and how they are associated with the URL routes. We will also learn how to create static routes.

Introduction

The homepage of a website can usually be found at the URL hostname followed by /, /home, /index or something self-explanatory.

These kinds of URLs enable the users to remember the URL and access it easily. It would be unexpected if the homepage were at a random URL such as /39283@&3911 or /more_eggs.

Flask allows us to use the route() decorator to bind a meaningful URL to each view function we create.

What is a view function?

In Flask, we create a function that acts as the view. Then, we bond it with a route.

 ...