Django Project Tutorial 2

Learning Objectives:

Follow the instructions in this tutorial:

Notes for PythonAnywhere

Remember that you never use runserver on PythonAnywhere:

python3 runserver     # <-- Never run this on pythonanywhere

Instead after you change files, run

python3 check

And then go to the the PythonAnywhere Web tab and press Reload.

Also when it tells you to navigate to a localhost like


Instead nagivate to the same path on your PythonAnywhere site:


If Your Model/Database Gets Messed Up

Since this is your first time doing a model and migrations, things can get messed up - if you want to clean up your database and start with a fresh database using the following instructions:

cd ~/django_projects/mysite
rm */migrations/00*
rm db.sqlite3
python makemigrations
python migrate
python createsuperuser    # If needed

You need to recreate the superuser because it is stored in the database and the rm command emptied out your database. You can do this process any time your database feels like it is messed up. But you have to re-enter all your data.