Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Python

Flask Routing

Map URLs to view functions with Flask route decorators and dynamic parameters.

Flask Routing — a practical guide to Flask routing with clear examples you can reuse in real projects.

Python Tutorial Series (67/95). Prefer one article? Read the complete Python tutorial.

Short description

Routes connect HTTP paths/methods to Python functions that return responses.

Routes

from flask import Flask
app = Flask(__name__)

@app.get('/hello/<name>')
def hello(name):
    return f'Hello {name}'

@app.post('/items')
def create_item():
    return {'ok': True}, 201

Leave a reply

Your email address will not be published. Required fields are marked *