Our next step is to explore the LocalLibrary administration web site that allows us to create, read, update, and delete data in our database.
If you are submitting this assignment to the DJ4E autograder for this assignment, it would be a good idea to check the autograder for specific instructions that the autograder requires for this assignment.
Complete the following sections of the Admin tutorial:
~/django_projects/locallibrary/catalog/admin.pyand register the four models
Webtab in PythonAnywhere
/adminto the end of your PythonAnywhere site (i.e. like http://mdntutorial.pythonanywhere.com/admin.
~/django_projects/locallibrary/catalog/models.pyat one point
Just as a reminder, when you are running on PythonAnywhere you do not need to do a:
python3 manage.py runserver # Don't do this on PythonAnywhere
Everytime you make a configuration change. But if you are running on
PythonAnywhere and make a configuration change you do need to
go into the
Web tab and
Reload the web server to re-read your updated configuration. There is
not harm in reloading your web on PythonAnywhere application too often. So when in doubt, reload :)
If you want to experiment a bit and you want to wipe out your database and start over, do the following:
cd ~/django_projects/locallibrary rm db.sqlite3 python3 manage.py migrate
This will wipe out all of your tables and the data in those tables and create fresh and empty tables. Note that this process will also wipe out your superuser accounts and all data you have entered.
db.sqlite3 file is a normal file - you can back it up and/or copy over it - just make sure to
your web application when you change your database.
Sometimes students set
Debug=False in the
This should be set to
Sometimes when commands like
python3 manage.py migrate
run without error, but the web application will not start on
PythonAnywhere, check to make sure your virtual environment is
properly set under the Web tab. If you did the
properly and created a
virtual environment, the virtual environment should be set to:
Replacing "drchuck" with your PythonAnywhere account name.