Prerequisite – How to Create a Basic Project using MVT in Django ?
Django is famous for its unique and fully managed app structure. For every functionality, an app can be created like a completely independent module. This article will take you through how to create a basic app and add functionalities using that app.
For example, if you are creating a Blog, Separate modules should be created for Comments, Posts, Login/Logout, etc. In Django, these modules are known as apps. There is a different app for each task.
Benefits of using Django apps –
- Django apps are reusable i.e. a Django app can be used with multiple projects.
- We has loosely coupled i.e. almost independent components
- Multiple developers can work on different components
- Debugging and code organisation is easy. Django has excellent debugger tool.
Pre-installed apps –
Django provides some pre-installed apps for users. To see pre-installed apps, navigate to projectName –> projectName –> settings.py
In your settings.py file, you will find INSTALLED_APPS. Apps listed in INSTALLED_APPS are provided by Django for developers comfort.

Also Visit –
Django ORM – Inserting, Updating & Deleting Data
Creating an App in Django :
Let us start building an app.
- To create a basic app in your Django project you need to go to directory containing
manage.pyand from there enter the command :python manage.py startapp projectApp
Now you can see your directory structure as under :
- To consider the app in your project you need to specify your project name in INSTALLED_APPS list as follows in settings.py:
# Application definitionINSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','projectApp']chevron_rightfilter_none - So, we have finally created an app but to render the app using urls we need to include the app in our main project so that urls redirected to that app can be rendered. Let us explore it.
Move toprojectName-> projectName -> urls.pyand add below code in the headerfrom django.urls import include
Now in the list of URL patterns, you need to specify app name for including your app urls. Here is the code for it –
fromdjango.contribimportadminfromdjango.urlsimportpath, includeurlpatterns=[path('admin/', admin.site.urls),# Enter the app name in following# syntax for this to workpath('', include("projectApp.urls")),]chevron_rightfilter_none - Now You can use the default MVT model to create URLs, models, views, etc. in your app and they will be automatically included in your main project.
The main feature of Django Apps is independence, every app functions as an independent unit in supporting the main project.
Recommended Posts:
- How to Create a Basic Project using MVT in Django ?
- How to create a form using Django Forms ?
- Django ModelForm - Create form from Models
- How to Create a basic API using Django Rest Framework ?
- Create View - Function based Views Django
- Class Based Generic Views Django (Create, Retrieve, Update, Delete)
- Django CRUD (Create, Retrieve, Update, Delete) Function Based Views
- wxPython - Create Radio Button using Create() function
- wxPython - Create Static Box using Create() method
- Django Tutorial
- Django Forms
- Django ModelFormSets
- Django Formsets
- Django Models | Set - 1
- Django Models
- Django Models | Set - 2
- Django Templates | Set - 2
- Django Templates | Set - 1
- Django Templates
- Django Basics
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : NaveenArora

