In this section, you will create a new Django app, called user
, register it with your project, and make it manage users.
At the beginning of Chapter 1, Building MyMDB, you learned that a Django project is made up of many Django apps (such as our existing core
app). A Django app should provide well-defined and tightly scoped behavior. Adding user management to our core
app violates that principle. Making a Django app bear too many responsibilities makes it harder to test and harder to reuse. For example, we’ll be reusing the code we write in this user
Django app throughout this book.
As we did when we created the core
app, we will use manage.py
to generate our user
app:
$ cd django
$ python manage.py startapp user
$ cd user
$ ls
__init__.py admin.py apps.py migrations models.py tests.py views.py
Next, we'll register it with our Django project by editing our django/config/settings.py
file and updating the INSTALLED_APPS...