1.

Describe the difference between Blueprints and Views in the Flask application?

Answer»

Blueprints: A Blueprint is a method of organizing a collection of related views and other code. INSTEAD of registering views and other code with an APPLICATION directly, they are REGISTERED with a blueprint. When the blueprint is available in the factory function, it is then registered with the application. Flask will have two blueprints, one for authentication and the other for blog postings. Each blueprint's code will be kept in its own module.

Views: The code you write to reply to queries to your application is known as a view function. Flask matches the incoming request URL to the view that should handle it using patterns. Flask converts the data RETURNED by the view into an outgoing response. Flask may also generate a URL for a view depending on its name and arguments in the other DIRECTION.



Discussion

No Comment Found