Add a new app to an exsiting project in Django

In the command line navigate into the exiting project, from here create the new app using the command:

python manage.py startapp <appname>

This creates a new directory with several python files:

  • init.py – defines this bundle of scripts as a package
  • admin.py – handles the admin side of the app
  • models.py – contains the model classes for the app, handles database stuff
  • tests.py – for writing unit tests
  • views.py – define the views for this app

There is also a migrations directory that will hold the database migrations for this app.

Register the new app with your Django project

Open settings.py in the main project, and add the app name to the ‘INSTALLED_APPS’ list.