Create a New application in your Django Project
As we have seen in the creation on our project , we know that a project is a collection of applications. So now we will see how to create an application
Type the command given below in your terminal to create an app :
$ python manage.py startapp appname
Example:
$ python manage.py startapp accounts
Once the app is created, the folders will look like this,
>accounts
>funda
>manage.py
Register your app in your project.
Whenever we create a new app, do not forget to register the app in the settings.py. You will find the settings.py inside the project folder.
-funda
-__init__.py
-asgi.py
-settings.py
-urls.py
-wsgi.py
>manage.py
Open the settings.py and add your application name in the INSTALLED_APPS list as shown below.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts', //add your appname here and don't forget to add the comma(,) in the last to avoid errors.
]
Tags: Funda of web it Django tutorials, Django tutorials, Django tutorials funda, django for beginners, how to create a new application in django, create new app in django