Open In App

Django Project MVT Structure

Last Updated : 16 Aug, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Django is based on MVT (Model-View-Template) architecture. MVT is a software design pattern for developing a web application. 

MVT Structure has the following three parts – 

Model: The model is going to act as the interface of your data. It is responsible for maintaining data. It is the logical data structure behind the entire application and is represented by a database (generally relational databases such as MySql, Postgres). To check more, visit – Django Models 

View: The View is the user interface — what you see in your browser when you render a website. It is represented by HTML/CSS/Javascript and Jinja files. To check more, visit – Django Views

Template: A template consists of static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted. To check more, visit – Django Templates 

 

 Project Structure :

A Django Project when initialized contains basic files by default such as manage.py, view.py, etc. A simple project structure is enough to create a single-page application. Here are the major files and their explanations. Inside the geeks_site folder ( project folder ) there will be the following files- 
 

manage.py- This file is used to interact with your project via the command line(start the server, sync the database… etc). For getting the full list of commands that can be executed by manage.py type this code in the command window- 

$ python manage.py help

 folder ( geeks_site ) – This folder contains all the packages of your project. Initially, it contains four files – 

  • _init_.py – It is a python package. It is invoked when the package or a module in the package is imported. We usually use this to execute package initialization code, for example for the initialization of package-level data.
  • settings.py – As the name indicates it contains all the website settings. In this file, we register any applications we create, the location of our static files, database configuration details, etc.
  • urls.py – In this file, we store all links of the project and functions to call.
  • wsgi.py – This file is used in deploying the project in WSGI. It is used to help your Django application communicate with the webserver.

Previous Article
Next Article

Similar Reads

How to Create a Basic Project using MVT in Django ?
Prerequisite - Django Project MVT Structure Assuming you have gone through the previous article. This article focuses on creating a basic project to render a template using MVT architecture. We will use MVT (Models, Views, Templates) to render data to a local server. Create a basic Project: To initiate a project of Django on Your PC, open Terminal
2 min read
Adding Tags Using Django-Taggit in Django Project
Django-Taggit is a Django application which is used to add tags to blogs, articles etc. It makes very easy for us to make adding the tags functionality to our django project.Setting up Django Project Installing django-taggit pip install django-taggitADD it to Main Project's settings.py file C/C++ Code INSTALLED_APPS = [ 'django.contrib.admin', 'dja
2 min read
How to customize Django forms using Django Widget Tweaks ?
Django forms are a great feature to create usable forms with just few lines of code. But Django doesn't easily let us edit the form for good designs. Here, we will see one of the ways to customize Django forms, So they will look according to our wish on our HTML page. Basically we will check the methods to include our own custom css, classes, or id
3 min read
Integrating Django with Reactjs using Django REST Framework
In this article, we will learn the process of communicating between the Django Backend and React js frontend using the Django REST Framework. For the sake of a better understanding of the concept, we will be building a Simple Task Manager and go through the primary concepts for this type of integration between React js and Django. Reactjs in a nuts
18 min read
Styling Django Forms with django-crispy-forms
Django by default doesn't provide any Django form styling method due to which it takes a lot of effort and precious time to beautifully style a form. django-crispy-forms solves this problem for us. It will let you control the rendering behavior of your Django forms in a very elegant and DRY way. Modules required:django : django installdjango-crispy
1 min read
Django Introduction | Set 2 (Creating a Project)
Note- This article is in continuation of Django introduction. Popularity of Django Django is used in many popular sites like as: Disqus, Instagram, Knight Foundation, MacArthur Foundation, Mozilla, National Geographic etc. There are more than 5k online sites based on Django framework. ( Source ) Sites like Hot Frameworks assess the popularity of a
3 min read
How to add RSS Feed and Sitemap to Django project?
This article is in continuation of Blog CMS Project in Django. Check this out here - Building Blog CMS (Content Management System) with Django RSS (Really Simple Syndication) Feed RSS (Really Simple Syndication) is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. These feeds ca
3 min read
Setup Sending Email in Django Project
Haven't you observed, when you register on some websites, you get mail from that company or institution? The email would be, a verification email or welcome email, account creation successful email or thanks-regard email, etc. For example, when you create a Google account, the first mail you get would be something like, "Hi Xyz, Welcome to Google.
3 min read
Top 10 Reasons to Choose Django Framework For Your Project
When it comes to choosing a new language or framework for a project what matters to most of the developers? Simplicity? Reliability? Built-in packages to save a lot of time? Security? Rapid development? Community support? Versatility? or what?….. Well, we can’t deny that we always want a language or framework that can fulfill most of the requiremen
9 min read
How to add Site Header, Site Title, Index Title in a Django Project?
Automatic admin interface one of the most powerful parts of Django. Metadata is read from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around. OVER
1 min read
Article Tags :
Practice Tags :