Package: django-backup-utils
Django Backup UtilsWith django-backup-utils you can:create backups with or without compressionlist available backups for your host & projectrestore databaserestore migration filesbackup/restore any directorymanage backups via admin interfacecheck if migrations are consistent with your migration recorder (Consistent Migrations).A backup always containstimestampper default a full dump of your database as json (using dumpdata)all migration .py files that are currently migrated.a customizable version stamp (e.g. commit hash)identifiers such as hostname, django project nameWhen restoring a backupautomatically get the latest backup for your host + projectsee the backup's version stampsee the current version stampsee differences between backup und current migrationsper default a blank unittest is run to ensure the fixture can be loaded (before anything is changed)Backup logs are saved to database.You can create/synchronize and restore backups via admin interface.Project-Structure neededprojectname/
    projectname/
      __init__.py
      settings.py
      ...
    App1 /
      migrations /
        __init__.py
        ...
    ...Quick start$ pip install django-backup-utilssettings.py:INSTALLED_APPS = [
    ...
    'django_backup_utils.apps.BackupUtilsConfig',
  ]

  BACKUP_ROOT = "/my/path/to/backupdir/"
  BACKUP_SYSTEM_VERSION = "my_build_id"BACKUP_ROOTspecifies a directory where your backups will be stored.BACKUP_SYSTEM_VERSIONidentification tag for your backup (e.g. your git commit hash/tag).Optional:BACKUP_DIRS = [](Default = []), specifies directories relative toBASE_DIRthat will be included in the backup,can also be an empty array. Example:BACKUP_DIRS = ["media", "somedir"]BACKUP_IGNORE_CONSISTENCY = True(Default = False), ignores inconsistency between the MigrationRecorder and local migration files.(Default): Backups that would contain inconsistent migrations cannot be created and raiseMigrationNotFoundexception.When changed toTrue, your backup will still contain all migration files that match the MigrationRecorder,however migration files that are not found locally can not be included in the backup. (This can only happen if you delete/rename migration files before you create a backup).urls.py:from django.urls import path, include

urlpatterns = [
    ...
    path('backup/', include('django_backup_utils.urls')),
]$ python3 manage.py migrateUsage$ python3 manage.py createbackup- create a backup that contains all database data, migration files and specified directories

    optional arguments:
      -h, --help            show this help message and exit
      --compress            compresses backup (.gz)
      --exclude             exclude specific apps or models <appname>.<model>
      --silent              mutes some output$ python3 manage.py loadbackup- load the latest backup

    optional arguments:
      -h, --help            show this help message and exit
      --tarpath TARPATH     load the specified backup tarfile
      --flush               flush the database (delete existing data)
      --deletedirs          delete all directories specified in settings.BACKUP_DIRS (before restoring)
      --noinput             disable all prompts
      --loadmigrations      restore all migration files
      --skiptest            skip the unittest for loading database dump
      --silent              mutes some output$ python3 manage.py listbackups- show backups located at settings.BACKUP_ROOT

    optional arguments:
      -h, --help            show this help message and exit
      --hostname HOSTNAME   show backups for specified hostname
      --projectname PROJECTNAME
                            show backups for specified django project
      --all                 show all backups
      --showinfo            show backup metadata
      --showlatest          show only latest backup$ python3 manage.py syncbackups- synchronizes existing backups for project + host with database

    optional arguments:
      -h, --help            show this help message and exit
      --silent              mutes some outputAdmin InterfaceWhat means what?Backup Overview:System Migrations: currently applied number of migrations recorded by your MigrationRecorder.System Migration files: current number of found migration files locally.Current System Version: yourBACKUP_SYSTEM_VERSIONas it is right now.A Backup object:Consistent Migrations:Truewhen the MigrationRecorder matches local migration files (None is missing).System Migrations (At dump time): number of system migrations when the dump was created.Dump Migration Files: number of migration files that have been archived in your dump.PermissionsPermission for restoring backups:django_backup_utils | can_restore_backupPermission for creating/synchronizing backups:django_backup_utils | can_add_backup