Learn Django

Contact App Setup - Create App

A new app is needed for the contacts functionality. Follow these steps to create it and add it to the project.

Step 1: Create the Contacts 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 contacts app
(venv)$ django-admin.py startapp contacts

Step 2: Update the Settings File

The next step is to add the app to the INSTALLED_APPS list in the settings file.

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

The INSTALLED_APPS should now look like this:

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

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 contacts app"

Track your progress with a free account