Grey Li
Grey Li

Reputation: 12762

What is the meaning of view in Flask view function?

I know how the routing system works in Flask, but I don't know why the function with route() decorator called view function. Does it relate to View in MVC architectural pattern? However, in this tutorial, the view function was included into Controller in MVC.

Upvotes: 3

Views: 1611

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121904

Werkzeug (the library that handles the WSGI routing functions) states you can call them views or controllers, per your preference. See the URL Routing section:

When it comes to combining multiple controller or view functions (however you want to call them), you need a dispatcher.

Werkzeug is based on the routes library, which in turn was inspired by Ruby on Rails. Rails used the term views to reference the V in the MVC model. But clearly, the terminology has become muddled.

Upvotes: 4

Related Questions