Skip to main content

A Django app to easily backup your sqlite database through an endpoint.

Project description

Django Sqlite Backup

A Django application to backup you SQLite database by calling and endpoint.

Installation

From PYPi using pip:

pip install django-sqlite-backup

Usage

Add the app to the INSTALLED_APPS:

INSTALLED_APPS = [
    ...,
    "django_sqlite_backup",
    ...,
]

Then, add the app's URLs to the root URL conf:

    path("", include("django_sqlite_backup.urls")),

This will create a route in your application to backup your sqlite database:

/backup/ which accepts only POST requests with authentication.

If the request succeeds it will return a 294. Otherwise, a 403 if the request was not authenticated.

Settings

You must define your settings in your settings.py:

SQLITE_BACKUP = {
    "BACKUP_CLASS": ...,
    "RESTORE_CLASS": ...,
    "BUCKET_NAME": ...,
}
  • BACKUP_CLASS must point to class which follows the SqliteBackup protocol.
  • RESTORE_CLASS must point to class which follows the SqliteRestore protocol.
  • BUCKET_NAME is the name of the bucket in S3 which can be written to.

Management commands

This app provides two commands for carrying out operations on the backups: backup and restore.

./manage.py backup

Will back up the current sqlite database into the configured bucket.

./manage.py restore [date_str]

Will restore your sqlite database from your configured bucket on the date specified. The date_str is optional and defaults to today.

AWS

By default, the backup class uses boto3 to backup the sqlite database into S3. Therefore, you will need to also pass the AWS Environment Variables to the environment where your application is running.

Licence

This package is distributed under MIT Licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_sqlite_backup-0.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file django_sqlite_backup-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sqlite_backup-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b4a2846fe1f355b25ab75c07d61a2655a83fa22ef2c17c3b0d16d1b7c47ba42
MD5 d7f7a30d349d0a5c4b7ed4dd8610d11d
BLAKE2b-256 eb1de55dbe8b1f81d55659347edbeca5749def53eae77cda10965beb67a389a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page