Creating a cart app
All the shopping cart functionalities will be managed in their own application. So, let’s create a cart app. Navigate to the top moviesstore
folder (the one which contains the manage.py
file) and run the following in the Terminal:
- For macOS, run the following command:
python3 manage.py startapp cart
- For Windows, run the following command:
python manage.py startapp cart
Figure 10.4 shows the new project structure. Verify it matches your current folder structure.
Figure 10.4 – The MOVIESSTORE project structure containing the cart app
Adding cart app in settings
Remember that for each newly created app, we must register it in the settings.py
file. In /moviesstore/settings.py
, under INSTALLED_APPS
, add the following lines in bold:
… INSTALLED_APPS = [ … 'movies', 'accounts', ...