Explore Flask

7.6. Summary

  • A blueprint is a collection of views, templates, static files and other extensions that can be applied to an application.
  • Blueprints are a great way to organize your application.
  • In a divisional structure, each blueprint is a collection of views, templates and static files which constitute a particular section of your application.
  • In a functional structure, each blueprint is just a collection of views. The templates are all kept together, as are the static files.
  • To use a blueprint, you define it then register it on the application with Flask.register_blueprint().
  • You can define a dynamic URL prefix that will be applied to all routes in a blueprint.
  • You can also define a dynamic subdomain for all routes in a blueprint.
  • Refactoring a growing application to use blueprints can be done in five relatively small steps.