URL Prefixes and Blueprint url_for
Namespace routes and link across blueprints.
Group URLs Under a Path
Often every route in a blueprint should sit under one path, like /admin. A url_prefix applies that path to the whole blueprint at once.
Set It at Registration
You pass the prefix when you register the blueprint. Every route inside then lives beneath that shared base path.
app.register_blueprint(admin, url_prefix="/admin")All lessons in this course
- Why Blueprints Beat One Giant File
- Create and Register a Blueprint
- URL Prefixes and Blueprint url_for
- Blueprint-Scoped Templates and Statics