Guide to MVT In Django | Django Project Structure

Haris Bin Nasir Avatar

·

·

The MVT (Model-View-Template) architecture is used by Django. MVT is a web application development software design pattern.

Their are three parts to the MVT Structure

Model: The model is going to be the interface through which data can be obtained for the Django Application. A model is a logical data structure used by Django to represent data present inside a database (usually a relational databases such as MySQL, PostgresSQL). Learn more: Django Models 

View: The View is the user interface, or what you see when you render a website in your browser. HTML/CSS/Javascript and Jinja files are used to represent it. Learn more: Django Views

Template: A template is made up of both static sections of the desired HTML output and specific syntax that describes how dynamic content will be included. Learn more: Django Templates

Project Structure :

When you first start a Django project, it comes with some basic files like manage.py and view.py. A single-page application can be created with a minimal project structure. The most important files and their descriptions are listed below.

manage.py- This file is used to interact with your project from the command line (for example, to start the server, sync the database, and so on). In the command window, type the following code to get the complete list of commands that manage.py may execute:

Copied!
$ python manage.py help

 folder ( app_name ) – This folder contains all of your project’s packages. It comes with four files at first. 

  • _init_.py – It’s a Python module. It is called when the package or one of its modules is imported. This is typically used to run package initialization code, such as the initialization of package-level data.
  • settings.py – It contains all of the website’s settings. We register any applications we develop in this file, as well as the location of our static files, database configuration details, and so on.
  • urls.py – We keep all of the project’s links and functions to call in this file.
  • wsgi.py – This file is used in the WSGI deployment of the project. It helps communication between your Django application and the webserver.

Leave a Reply

Your email address will not be published. Required fields are marked *