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?
views.py
has become a common practice, but it isn't required.templates
is the default location for templates, although that can be changed with thetemplate_folder
argument. – Scolecite