Pro-tips
Use django unfold and it's integrations
Django unfold has some usuful integrations for the admin panel, such as Import/export. Have a look at the docs!
Create and use management commands
See the django docs
These are useful for a variety of situations:
- Getting some data from the db and displaying it in the terminal for debugging
- Registering a webhook url in an external service
- Debugging/Developing an entire feature, for instance running only part of an asynchronous process (so you don't need to bother with Bruno or the frontend). Great as a playground
Cloning the database
You can create a dump for the current environment by running just clone_db
. This will create a postgres binary dump file inside of dumps/{branch-name}.dump
. You can restore this into your desired database with the following command:
Replace localhost with your docker host if you're running docker! Don't forget to change db name and the filename as well
pg_restore --no-acl -h localhost -d {your-db-name} ./dumps/{branch_name}.dump
Avoid doing this in production. If you have access to it for some reason, that is.