flask.views View Example Code

View is a class within the flask.views module of the Flask project. View provides an alternative way to use view functions by subclassing this class and implementing dispatch_request for the routing system. This is typically only used in more advanced situations such as extending the Flask source code, rather than a standard way of interacting with the framework.

MethodView and http_method_funcs are a couple of other callables within the flask.views package that also have code examples.

These topics are also useful while reading the View examples:

Example 1 from FlaskBB

FlaskBB (project website) is a Flask-based forum web application. The web app allows users to chat in an open message board or send private messages in plain text or Markdown.

FlaskBB is provided as open source under this license.

FlaskBB / flaskbb / utils / views.py

Example 2 from Datadog Flask Example App

The Datadog Flask example app contains many examples of the Flask core functions available to a developer using the web framework.

Datadog Flask Example App / python/flask/app / app.py