Mvc and Mvt classes

1- How to internet work –

(flask has no own data base, so we can use different data base (mysql, apache, SQLite))  

2- Working with model views templates: MVC and MVT MVC

Model – Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes. View – View represents the visualization of the data that model contains. Controller – Controller acts on both model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps view and model separate.

MVT

The MVT (Model View Template) is a software design pattern.

It is a collection of three important components’ Model’ ‘ View’ and ‘Template’. The Model helps to handle database.

It is a data access layer which handles the data.

The Template is a presentation layer which handles User Interface part completely.

The View is used to execute the business logic and interact with a model to carry data and renders a template.

3- Working with flask views

This above pic showing first we send request to browser, browser directly send to views ,views take logic from model using database and template(write code using HTML,CSS).


Example-

from flask import Flask , render_template app = Flask(__name__) @app.route(‘/’) def index(): return ‘hello world’ (“here we find to write some ‘url link’ so we used views template”) “” return (index.html)””(also import render template

Open chat