I noticed frameworks such as flask typically have a module named views to house the:
@app.route('/')
def index():
return render_template('index.html')
type of definitions and then the jinja2 templates are under the templates directory, however a lot of the node.js frameworks (sails, geddy, locomotive) tend to put the .ejs templates in the views directory instead and have no templates directory.
It seems like this shouldn't be subjective; which is correct as per the MVC model? Should the template files be under the views directory or should the url handler definitions? From what I can tell, the flask application seems to have the correct definition of views; if this is in fact the case, where do flask controllers come in or are these definitions controllers too?
When it comes to frameworks like Flask or Django, they rather use MVT (Model/View/Template) but it is similar to MVC except for terminology. The difference is that the 'T' in MVT stands for Template which is actually the Controller in MVC. So View in Flask is the same as Controller.
So don't think of it as templates vs views but focus on the part that you still have 3 components: Model, Business Logic (view/controllers etc), Visuals (template/html etc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With