About Not Saving Session Data in Database Backups

Use the --exclude-table-data parameter to exclude session data from Django PostgreSQL database backups:

1
2
3
$ pg_dump --username=website_username --format=p \
--exclude-table-data=django_session \
--file=latest.backup website_dbname

Tips and Tricks Dev Ops Databases Django 4.2 Django 3.2 Django 2.2 PostgreSQL