Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
URL Routing | Introduction to Flask
Flask Intensive Course: Web Development with Python
course content

Course Content

Flask Intensive Course: Web Development with Python

Flask Intensive Course: Web Development with Python

1. Introduction to Flask
2. Database
3. Implement CRUD
4. FrontEnd Design

bookURL Routing

In the previous chapter, we used the default root route, which serves as the home page when the URL is "/", and now we will explore other routing capabilities.

When you look at the URLs of everyday services, you'll notice that many of them include variable parts. Like your LinkedIn profile URL: www.linkedin.com/<your-name> , where your name is part of it. Flask handles these kinds of URLs using a special format in the route decorator. Here's an example that shows a route with a dynamic name part:

If we enter the http://127.0.0.1:5000/home/Joey in your web browser URL field, you will receive:

Also, we can pass integers and other data types.

We can use any number of routes to our function. For example:

And both endpoints will return to the same page.

1. What type of variable should be used in the route when expecting an integer as part of the URL path?
2. In Flask, how many unique routes can be created using the following route decorators?
3. Which HTTP methods can be used in a Flask route by default?
What type of variable should be used in the route when expecting an integer as part of the URL path?

What type of variable should be used in the route when expecting an integer as part of the URL path?

Select the correct answer

In Flask, how many unique routes can be created using the following route decorators?

In Flask, how many unique routes can be created using the following route decorators?

Select the correct answer

Which HTTP methods can be used in a Flask route by default?

Which HTTP methods can be used in a Flask route by default?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4
We're sorry to hear that something went wrong. What happened?
some-alt