0PricingLogin
Flask Academy · Lesson

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

  1. Why Blueprints Beat One Giant File
  2. Create and Register a Blueprint
  3. URL Prefixes and Blueprint url_for
  4. Blueprint-Scoped Templates and Statics
← Back to Flask Academy