Learn Django

Checkpoint

This chapter showed you how to create the contacts app, and build all the components necessary to display contact records on the account detail page. In this lesson you'll learn how to verify it's all working correctly. If it is then you'll push the updates to Heroku.

Verify on Local Computer

To verify the work on your local computer you need to start the dev web server.

1
2
3
4
5
6
# make sure you're at an activated terminal/cmd in the crmeasy dir
(venv)$ pwd
/<your_path>/crmeasy

# start the development server
(venv)$ python manage.py runserver

With the web server started complete these steps:

1. Create a Contact

  1. Open the admin site
  2. Locate and open the contacts app
  3. Click the new contact button, and fill out the fields to create a new contact. Remember which account you related the contact to

2. Open the Account Detail

  1. Open the Account List page
  2. Click on the account that you related the contact to
  3. Verify the contact shows up on the account detail page

Verify on Heroku

In this last step we'll push the new app and model to the Heroku app. In addition to pushing the code change we also need to run a South migration.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# push the files to heroku
(venv)$ git push heroku contacts_part_1:master

# create and commit the migration 
(venv)$ heroku run python manage.py makemigrations contacts

# commit the migration
(venv)$ heroku run python manage.py migrate contacts

# open the Heroku app
(venv)$ heroku open

Once the Heroku app opens follow the steps in the previous step to verify all is working on the Heroku app.

Track your progress with a free account