π» API Progress Check-In π»
Posted on Sep 22nd, 2022
ποΈ Todayβs Topics
- How are the projects coming along? π
- Automatic deploys from GitHub
- Paginating your API
π― Project
Keep on going. πͺ π
We will use class time today to get you past any blockers you may be experiencing and to talk through next steps.
By now you should have provided your front end with endpoints to see data and gotten djoser installed so that your log in and log out endpoints are working.
By tomorrow you should have the ability to create at least questions or cards via POST requests, and maybe more.
π Read | πΊ Watch | π§ Listen
On Monday weβll be covering full-text search in your API, but if you have time you can check these resources out in advance.
- Search from the Ground Up -> DjangoCon 2019 video explaining search in detail
- π Basic and Full-Text Search with Django and Postgres
- π Blog post with more on full-text search
- π If you want A LOT more detail about full-text search in Postgres and Django, this blog piece has you covered
π Resources
Authentication
Make sure you are sharing the Djoser information with your front end. You should include the authentication endpoints in your API documentation or project README.
- Base Endpoint Guide for Djoser -> includes create a new user and other nice stuff
- Token Authentication Endpoint Guide for Djoser -> details on the token auth endpoints
Creating a properly hashed password
In order to save a properly hashed password when you create a new user in the Django Admin, make sure you are using UserAdmin
in admin.py
so that you have that option in the admin interface. If you donβt do this and save an unhashed password, you will run into authentication errors.
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
...
admin.site.register(User, UserAdmin)
You can also change a password from the command line: