Create the new app
Let's start by creating a new app with the django command-line tool:
-
Create a new empty app with the django command:
cd apps
pipenv run django-admin startapp <app_name>For this example, let's assume we created an app called
event
. -
Now open the
apps.py
file in your<app_name>
folder, and addapps.
to the name attribue:backend/apps/event/apps.pyfrom django.apps import AppConfig
class EventConfig(AppConfig):
name = 'apps.event' # add 'apps.' to the name attribute -
Then, add your app to the
INSTALLED_APPS
list in the djangosettings
:backend/config/settings/base.pyDJANGO_APPS = # ...
THIRD_PARTY_APPS = # ...
COMMON_APPS = [
# ...
"apps.event",
]
INSTALLED_APPS = DJANGO_APPS + COMMON_APPS + THIRD_PARTY_APPS -
Finally, we need to update your database:
pipenv run migrate