Thursday, September 17, 2020

Create a new app to project Django

 First create a new projet if not there.

django-admin startproject projectname

After that create app inside it using manage.py


django-admin startapp demo 

(or)

python3 manage.py startapp appname

This will generate a courses folder and also apps.py with below code automatically.

#in the apps.py create class.

from django.apps import AppConfig

class CoursesConfig(AppConfig):

  name = 'courses'


After that,register that app(lets say courses) in project settings.py

i.e., Add entry in installed_apps of settings.py

settings.py

----

INSTALLED_APPS = [

'courses.apps.CoursesConfig',

...

...

]




No comments:

Post a Comment