Below are two common (and safe) ways to grab absolutely everything that lives in the PostgreSQL database behind your Django project—including the auth_user table and any custom data.
🎯 1. Native PostgreSQL dump (recommended for a full-fidelity backup)
This bypasses Django completely and dumps the database exactly as PostgreSQL sees it.
Step 0 – Find your connection settings
Look in settings.py:
Cheat-sheet flags
• --format=custom → produces a single binary file that can be streamed or gzip’d
• --blobs → includes large objects (files stored in the DB)
• --schema=public → add if you only want the public schema
Step 2 – Restore somewhere else
bash
# Create an empty target DB first
createdb -U myuser -h localhost newdb
# Then restore
PGPASSWORD=secret pg_restore \
-U myuser \
-h localhost \
-p 5432 \
--dbname=newdb \
--verbose \
mydb.dump
🛠️ 2. Django “fixture” export (JSON) via manage.py dumpdata
Good for migrating data between Django projects with compatible models.
(Downside: performance on huge DBs, and it doesn’t capture DB-level things like extensions, indexes created manually, etc.)
That file now contains every model row, including auth.User.
Skip the exclusions if you really want those tables too, just mind duplicates on re-import.
Step 2 – Load into another project:
bash
# Make sure you’ve migrated first
python manage.py migrate
python manage.py loaddata full_export.json
🚨 A few best-practice tips
Always take dumps from a read-only or low-traffic window (locks can stall).
Version control your migration files, but never large DB dumps. Keep them in object storage (S3, GCS, etc.) or an off-site backup.
Pair the DB dump with your media/ folder if user-uploaded files matter.
Test the restore process periodically; a backup you can’t restore is just extra disk usage.
That’s it! Pick the method that matches your use-case (pg_dump for 1-to-1 backups, dumpdata for cross-project Django moves) and you’ll have the whole shebang—users and all.