Styrow.dev
Question 40 of 45
Python Topic: General medium

Is Flask an MVC model and if yes give an example showing MVC pattern for your application?

Question

Is Flask an MVC model and if yes give an example showing MVC pattern for your application?

Answer

Basically, Flask is a minimalistic framework which behaves same as MVC framework. So MVC is a perfect fit for Flask, and the pattern for MVC we will consider for the following example from flask import Flask app = Flask(name) @app.route(""/"") Def hello(): return ""Hello World"" app.run(debug = True)

In this code your, Configuration part will be from flask import Flask app = Flask(name) View part will be @app.route(""/"") Def hello(): return ""Hello World"" While you model or main part will be app.run(debug = True)