Skip to content

Instantly share code, notes, and snippets.

@MarlonJD
Created November 5, 2020 14:46
Show Gist options
  • Save MarlonJD/baf472f13686087f99911b5595a77c26 to your computer and use it in GitHub Desktop.
Save MarlonJD/baf472f13686087f99911b5595a77c26 to your computer and use it in GitHub Desktop.
Backup All Django project
Restore fresh database
When you backup whole database by using dumpdata command, it will backup all the database tables
If you use this database dump to load the fresh database(in another django project), it can be causes IntegrityError (If you loaddata in same database it works fine)
To fix this problem, make sure to backup the database by excluding contenttypes and auth.permissions tables
python manage.py dumpdata --exclude auth.permission --exclude contenttypes > db.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment