Learn Django

Create the Marketing App

The first Django app in the project will be the marketing app. The marketing app will be used to store parts of the application responsible for displaying the home page and any future marketing related pages. Follow these steps to create it.

Step 1: Create the Marketing App

With your terminal or command prompt open, execute these commands.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# navigate to crmeasy directory
$ cd /<your_path_here>/crmeasy

# activate the virtual environment
$ source venv/bin/activate

#  navigate to the crmapp directory 
(venv)$ cd crmapp/

# create the marketing app
(venv)$ django-admin startapp marketing

Step 2: Update the Settings File

Django apps need to be registered in the settings file. This is a critical step as it makes Django aware that the app exists so it can do things like perform database migrations on the app (if required). In this step you'll add the new marketing app to the settings file.

  1. Open the /.../crmeasy/crmapp/settings.py file
  2. Locate INSTALLED_APPS
  3. Add 'crmapp.marketing', to the end of the list

The INSTALLED_APPS should now look like this:

1
2
3
4
5
6
7
8
9
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'crmapp.marketing',
)

You've just completed the setup of the marketing app.

Step 3: Commit Changes

Execute these commands to commit your changes in Git.

1
2
3
4
5
# add files
(venv)$ git add .

# commit files
(venv)$ git commit -m "created the marketing app"

Track your progress with a free account