π» Welcome to Advanced Back End π»
Posted on Sep 6th, 2022
β οΈ You only need to read this post if you are on the back end team π»
ποΈ Todayβs Topics
- Using PostgreSQL with Django
- Deploying Django applications to Heroku
π― Project: Habit Tracker
Youβll be working on Habit Tracker this week.
Itβs important to read the project requirements thoroughly and to start to think about how you would do this project.
First steps: generate the project skeleton; make sure you are using Postgres; deploy to Heroku; and design your models. Make sure to create a diagram showing model fields and relationships. Talk through with each other how you are thinking about this.
By tomorrow:
- Your application should be deployed to Heroku.
- Your models should be functional β that means you can see and work with them at least in the admin (and ideally in the Django shell) and they do what they are supposed to do.
- You should be able to create habits and associated daily records in the Django shell (I recommend using
shell_plus
which is available when you havedjango-extensions
installed).
π Read | πΊ Watch | π§ Listen
These are this weekβs required readings, videos, and/or podcasts. Read, watch, or listen, and take notes.
Deployment
- πΊ Katie McLaughlin, What is Deployment, Anyway?
- π Full Stack Python: Deployment
- π Heroku Reference: Deploying Django Apps to Heroku
- π§ Deploying and Running Django Web Apps in 2021
Databases & Data Modeling
- π Full Stack Python: Databases
- π Full Stack Python: ORMs
- π What is a relational database?
- π Class-Responsibility-Collaborator Model (CRC)
- πΊ Entity Relationship Diagrams (ERD), from Lucid Chart
- π Writing Safe Database Migrations in Django
Debugging
- π Python Debugging with Pdb
- πΊ Python Debugging with Pdb - Course on RealPython - only the first three videos are free but they are useful!
- πΊ Damilare Onajole, Debugging Python
π Resources
Authentication, Registration, and the User Model in Django
- django-registration-redux
- We are using the simple (one-step) backend
- Django docs: User Authentication
- Django docs: built-in User Model -> documentation for all the things you get for free with the User from Django
- Django docs: Extending the built-in User Model with AbstractUser
- Django Best Practices: Custom User Model -> This tutorial is good to read for an overview, but you donβt need to follow the instructions to implement the forms to create or change a user, since we are using the
django-registration-redux
package for that.
- Django Best Practices: Custom User Model -> This tutorial is good to read for an overview, but you donβt need to follow the instructions to implement the forms to create or change a user, since we are using the
- Django docs: Authentication in Web Requests ->
django-registration-redux
handles some of this for us (giving us the login and logout urls, for instance) but itβs helpful to see other ways you can use the authenticated user. - The
login_required
decorator - Limiting access to logged-in users that pass a test
Deployment & Other Useful Stuff
- Walkthrough: Starting a new Django Project
- π Deploying a Django app to Heroku
- Using Postgres Locally
- Django Docs: Deployment Checklist
- How to use django-extensions
shell_plus