django-dbbackup


Namedjango-dbbackup JSON
Version 4.2.1 PyPI version JSON
download
home_pagehttps://github.com/jazzband/django-dbbackup
SummaryManagement commands to help backup and restore a project database and media.
upload_time2024-08-23 22:18:05
maintainerNone
docs_urlNone
authorArchmonger
requires_python>=3.7
licenseBSD
keywords django database media backup amazon s3 dropbox
VCS
bugtrack_url
requirements django pytz
Travis-CI No Travis.
coveralls test coverage
            Django Database Backup
======================

.. image:: https://github.com/jazzband/django-dbbackup/actions/workflows/build.yml/badge.svg
        :target: https://github.com/jazzband/django-dbbackup/actions

.. image:: https://readthedocs.org/projects/django-dbbackup/badge/?version=stable
        :target: https://django-dbbackup.readthedocs.io/
        :alt: Documentation Status

.. image:: https://codecov.io/gh/jazzband/django-dbbackup/branch/master/graph/badge.svg?token=zaYmStcsuX
        :target: https://codecov.io/gh/jazzband/django-dbbackup

.. image:: https://jazzband.co/static/img/badge.svg
        :target: https://jazzband.co/
        :alt: Jazzband

This Django application provides management commands to help backup and
restore your project database and media files with various storages such as
Amazon S3, Dropbox, local file storage or any Django storage.

It is made to:

- Allow you to secure your backup with GPG signature and encryption
- Archive with compression
- Deal easily with remote archiving
- Keep your development database up to date
- Use Crontab or Celery to setup automated backups

Docs
====

See our official documentation at `Read The Docs`_.

Why use DBBackup
================

This software doesn't reinvent the wheel, in a few words it is a pipe between
your Django project and your backup storage. It tries to use the traditional dump &
restore mechanisms, apply compression and/or encryption and use the storage system you desire.

It gives a simple interface to backup and restore your database or media
files.

Management Commands
===================

dbbackup
--------

Backup your database to the specified storage. By default this will backup all
databases specified in your settings.py file and will not delete any old
backups. You can optionally specify a server name to be included in the backup
filename.

::

  Usage: ./manage.py dbbackup [options]
  
  Options:
    --noinput             Tells Django to NOT prompt the user for input of any
                          kind.
    -q, --quiet           Tells Django to NOT output other text than errors.
    -c, --clean           Clean up old backup files
    -d DATABASE, --database=DATABASE
                          Database to backup (default: everything)
    -s SERVERNAME, --servername=SERVERNAME
                          Specify server name to include in backup filename
    -z, --compress        Compress the backup files
    -e, --encrypt         Encrypt the backup files
    -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME
                          Specify filename on storage
    -O OUTPUT_PATH, --output-path=OUTPUT_PATH
                          Specify where to store on local filesystem
    -x EXCLUDE_TABLES, --exclude-tables=EXCLUDE_TABLES
                          Exclude tables data from backup (-x 'public.table1, public.table2')

dbrestore
---------

Restore your database from the specified storage. By default this will lookup
the latest backup and restore from that. You may optionally specify a
servername if you you want to backup a database image that was created from a
different server. You may also specify an explicit local file to backup from.

::

  Usage: ./manage.py dbrestore [options]
  
  Options:
    --noinput             Tells Django to NOT prompt the user for input of any
                          kind.
    -d DATABASE, --database=DATABASE
                          Database to restore
    -i INPUT_FILENAME, --input-filename=INPUT_FILENAME
                          Specify filename to backup from
    -I INPUT_PATH, --input-path=INPUT_PATH
                          Specify path on local filesystem to backup from
    -s SERVERNAME, --servername=SERVERNAME
                          Use a different servername backup
    -c, --decrypt         Decrypt data before restoring
    -p PASSPHRASE, --passphrase=PASSPHRASE
                          Passphrase for decrypt file
    -z, --uncompress      Uncompress gzip data before restoring


mediabackup
-----------

Backup media files by get them one by one, include in a TAR file. ::

  Usage: ./manage.py mediabackup [options]
  
  Options:
    --noinput             Tells Django to NOT prompt the user for input of any
                          kind.
    -q, --quiet           Tells Django to NOT output other text than errors.
    -c, --clean           Clean up old backup files
    -s SERVERNAME, --servername=SERVERNAME
                          Specify server name to include in backup filename
    -z, --compress        Compress the archive
    -e, --encrypt         Encrypt the backup files
    -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME
                          Specify filename on storage
    -O OUTPUT_PATH, --output-path=OUTPUT_PATH
                          Specify where to store on local filesystem

mediarestore
------------

Restore media files from storage backup to your media storage. ::

  Usage: ./manage.py mediarestore [options]
  
  Options:
    --noinput             Tells Django to NOT prompt the user for input of any
                          kind.
    -q, --quiet           Tells Django to NOT output other text than errors.
    -i INPUT_FILENAME, --input-filename=INPUT_FILENAME
                          Specify filename to backup from
    -I INPUT_PATH, --input-path=INPUT_PATH
                          Specify path on local filesystem to backup from
    -e, --decrypt         Decrypt data before restoring
    -p PASSPHRASE, --passphrase=PASSPHRASE
                          Passphrase for decrypt file
    -z, --uncompress      Uncompress gzip data before restoring
    -r, --replace         Replace existing files

Tests
=====

Tests are stored in `dbbackup.tests` and to run them you must launch:

::

    python runtests.py

In fact, ``runtests.py`` acts as a ``manage.py`` file and all Django commands
are available. So you could launch:

::

    python runtests.py shell

to get a Python shell configured with the test project. Also all test
command options are available and usable to run only a selection of tests.
See `Django test command documentation`_ for more information about it.

.. _`Django test command documentation`: https://docs.djangoproject.com/en/stable/topics/testing/overview/#running-tests

There are even functional tests: ::

    ./functional.sh

See documentation for details.

To run the tests across all supported versions of Django and Python, you
can use Tox. Firstly install Tox:

::

    pip install tox

To run the tests just use the command ``tox`` in the command line.  If you
want to run the tests against just one specific test environment you can run
``tox -e <testenv>``.  For example, to run the tests with Python3.9 and
Django3.2 you would run:

::

    tox -e py39-django32

The available test environments can be found in ``tox.ini``.

Contributing
============

.. image:: https://jazzband.co/static/img/jazzband.svg
   :target: https://jazzband.co/
   :alt: Jazzband

This is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree
to abide by the `Contributor Code of Conduct <https://jazzband.co/about/conduct>`_
and follow the `guidelines <https://jazzband.co/about/guidelines>`_.

All contribution are very welcomed, propositions, problems, bugs and
enhancement are tracked with `GitHub issues`_ system and patches are submitted
via `pull requests`_.

We use GitHub Actions as continuous integration tools.

.. _`Read The Docs`: https://django-dbbackup.readthedocs.org/
.. _`GitHub issues`: https://github.com/jazzband/django-dbbackup/issues
.. _`pull requests`: https://github.com/jazzband/django-dbbackup/pulls
.. _Coveralls: https://coveralls.io/github/jazzband/django-dbbackup

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jazzband/django-dbbackup",
    "name": "django-dbbackup",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "django, database, media, backup, amazon, s3, dropbox",
    "author": "Archmonger",
    "author_email": "archiethemonger@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/93/180d0fcf0d7da8bcaca7aeb6ba27490bd18132d8c625b2c1a1c8f03516bf/django_dbbackup-4.2.1.tar.gz",
    "platform": null,
    "description": "Django Database Backup\r\n======================\r\n\r\n.. image:: https://github.com/jazzband/django-dbbackup/actions/workflows/build.yml/badge.svg\r\n        :target: https://github.com/jazzband/django-dbbackup/actions\r\n\r\n.. image:: https://readthedocs.org/projects/django-dbbackup/badge/?version=stable\r\n        :target: https://django-dbbackup.readthedocs.io/\r\n        :alt: Documentation Status\r\n\r\n.. image:: https://codecov.io/gh/jazzband/django-dbbackup/branch/master/graph/badge.svg?token=zaYmStcsuX\r\n        :target: https://codecov.io/gh/jazzband/django-dbbackup\r\n\r\n.. image:: https://jazzband.co/static/img/badge.svg\r\n        :target: https://jazzband.co/\r\n        :alt: Jazzband\r\n\r\nThis Django application provides management commands to help backup and\r\nrestore your project database and media files with various storages such as\r\nAmazon S3, Dropbox, local file storage or any Django storage.\r\n\r\nIt is made to:\r\n\r\n- Allow you to secure your backup with GPG signature and encryption\r\n- Archive with compression\r\n- Deal easily with remote archiving\r\n- Keep your development database up to date\r\n- Use Crontab or Celery to setup automated backups\r\n\r\nDocs\r\n====\r\n\r\nSee our official documentation at `Read The Docs`_.\r\n\r\nWhy use DBBackup\r\n================\r\n\r\nThis software doesn't reinvent the wheel, in a few words it is a pipe between\r\nyour Django project and your backup storage. It tries to use the traditional dump &\r\nrestore mechanisms, apply compression and/or encryption and use the storage system you desire.\r\n\r\nIt gives a simple interface to backup and restore your database or media\r\nfiles.\r\n\r\nManagement Commands\r\n===================\r\n\r\ndbbackup\r\n--------\r\n\r\nBackup your database to the specified storage. By default this will backup all\r\ndatabases specified in your settings.py file and will not delete any old\r\nbackups. You can optionally specify a server name to be included in the backup\r\nfilename.\r\n\r\n::\r\n\r\n  Usage: ./manage.py dbbackup [options]\r\n  \r\n  Options:\r\n    --noinput             Tells Django to NOT prompt the user for input of any\r\n                          kind.\r\n    -q, --quiet           Tells Django to NOT output other text than errors.\r\n    -c, --clean           Clean up old backup files\r\n    -d DATABASE, --database=DATABASE\r\n                          Database to backup (default: everything)\r\n    -s SERVERNAME, --servername=SERVERNAME\r\n                          Specify server name to include in backup filename\r\n    -z, --compress        Compress the backup files\r\n    -e, --encrypt         Encrypt the backup files\r\n    -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME\r\n                          Specify filename on storage\r\n    -O OUTPUT_PATH, --output-path=OUTPUT_PATH\r\n                          Specify where to store on local filesystem\r\n    -x EXCLUDE_TABLES, --exclude-tables=EXCLUDE_TABLES\r\n                          Exclude tables data from backup (-x 'public.table1, public.table2')\r\n\r\ndbrestore\r\n---------\r\n\r\nRestore your database from the specified storage. By default this will lookup\r\nthe latest backup and restore from that. You may optionally specify a\r\nservername if you you want to backup a database image that was created from a\r\ndifferent server. You may also specify an explicit local file to backup from.\r\n\r\n::\r\n\r\n  Usage: ./manage.py dbrestore [options]\r\n  \r\n  Options:\r\n    --noinput             Tells Django to NOT prompt the user for input of any\r\n                          kind.\r\n    -d DATABASE, --database=DATABASE\r\n                          Database to restore\r\n    -i INPUT_FILENAME, --input-filename=INPUT_FILENAME\r\n                          Specify filename to backup from\r\n    -I INPUT_PATH, --input-path=INPUT_PATH\r\n                          Specify path on local filesystem to backup from\r\n    -s SERVERNAME, --servername=SERVERNAME\r\n                          Use a different servername backup\r\n    -c, --decrypt         Decrypt data before restoring\r\n    -p PASSPHRASE, --passphrase=PASSPHRASE\r\n                          Passphrase for decrypt file\r\n    -z, --uncompress      Uncompress gzip data before restoring\r\n\r\n\r\nmediabackup\r\n-----------\r\n\r\nBackup media files by get them one by one, include in a TAR file. ::\r\n\r\n  Usage: ./manage.py mediabackup [options]\r\n  \r\n  Options:\r\n    --noinput             Tells Django to NOT prompt the user for input of any\r\n                          kind.\r\n    -q, --quiet           Tells Django to NOT output other text than errors.\r\n    -c, --clean           Clean up old backup files\r\n    -s SERVERNAME, --servername=SERVERNAME\r\n                          Specify server name to include in backup filename\r\n    -z, --compress        Compress the archive\r\n    -e, --encrypt         Encrypt the backup files\r\n    -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME\r\n                          Specify filename on storage\r\n    -O OUTPUT_PATH, --output-path=OUTPUT_PATH\r\n                          Specify where to store on local filesystem\r\n\r\nmediarestore\r\n------------\r\n\r\nRestore media files from storage backup to your media storage. ::\r\n\r\n  Usage: ./manage.py mediarestore [options]\r\n  \r\n  Options:\r\n    --noinput             Tells Django to NOT prompt the user for input of any\r\n                          kind.\r\n    -q, --quiet           Tells Django to NOT output other text than errors.\r\n    -i INPUT_FILENAME, --input-filename=INPUT_FILENAME\r\n                          Specify filename to backup from\r\n    -I INPUT_PATH, --input-path=INPUT_PATH\r\n                          Specify path on local filesystem to backup from\r\n    -e, --decrypt         Decrypt data before restoring\r\n    -p PASSPHRASE, --passphrase=PASSPHRASE\r\n                          Passphrase for decrypt file\r\n    -z, --uncompress      Uncompress gzip data before restoring\r\n    -r, --replace         Replace existing files\r\n\r\nTests\r\n=====\r\n\r\nTests are stored in `dbbackup.tests` and to run them you must launch:\r\n\r\n::\r\n\r\n    python runtests.py\r\n\r\nIn fact, ``runtests.py`` acts as a ``manage.py`` file and all Django commands\r\nare available. So you could launch:\r\n\r\n::\r\n\r\n    python runtests.py shell\r\n\r\nto get a Python shell configured with the test project. Also all test\r\ncommand options are available and usable to run only a selection of tests.\r\nSee `Django test command documentation`_ for more information about it.\r\n\r\n.. _`Django test command documentation`: https://docs.djangoproject.com/en/stable/topics/testing/overview/#running-tests\r\n\r\nThere are even functional tests: ::\r\n\r\n    ./functional.sh\r\n\r\nSee documentation for details.\r\n\r\nTo run the tests across all supported versions of Django and Python, you\r\ncan use Tox. Firstly install Tox:\r\n\r\n::\r\n\r\n    pip install tox\r\n\r\nTo run the tests just use the command ``tox`` in the command line.  If you\r\nwant to run the tests against just one specific test environment you can run\r\n``tox -e <testenv>``.  For example, to run the tests with Python3.9 and\r\nDjango3.2 you would run:\r\n\r\n::\r\n\r\n    tox -e py39-django32\r\n\r\nThe available test environments can be found in ``tox.ini``.\r\n\r\nContributing\r\n============\r\n\r\n.. image:: https://jazzband.co/static/img/jazzband.svg\r\n   :target: https://jazzband.co/\r\n   :alt: Jazzband\r\n\r\nThis is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree\r\nto abide by the `Contributor Code of Conduct <https://jazzband.co/about/conduct>`_\r\nand follow the `guidelines <https://jazzband.co/about/guidelines>`_.\r\n\r\nAll contribution are very welcomed, propositions, problems, bugs and\r\nenhancement are tracked with `GitHub issues`_ system and patches are submitted\r\nvia `pull requests`_.\r\n\r\nWe use GitHub Actions as continuous integration tools.\r\n\r\n.. _`Read The Docs`: https://django-dbbackup.readthedocs.org/\r\n.. _`GitHub issues`: https://github.com/jazzband/django-dbbackup/issues\r\n.. _`pull requests`: https://github.com/jazzband/django-dbbackup/pulls\r\n.. _Coveralls: https://coveralls.io/github/jazzband/django-dbbackup\r\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Management commands to help backup and restore a project database and media.",
    "version": "4.2.1",
    "project_urls": {
        "Homepage": "https://github.com/jazzband/django-dbbackup"
    },
    "split_keywords": [
        "django",
        " database",
        " media",
        " backup",
        " amazon",
        " s3",
        " dropbox"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c56269824e8ae46772c3506c72ece58148f13e65a2ffaed42c5bd428960a729",
                "md5": "84ab4a9dad7485ab55c570909f48f307",
                "sha256": "b23265600ead0780ca781b1b4b594949aaa8a20d74f08701f91ee9d7eb1f08cd"
            },
            "downloads": -1,
            "filename": "django_dbbackup-4.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "84ab4a9dad7485ab55c570909f48f307",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 59133,
            "upload_time": "2024-08-23T22:18:03",
            "upload_time_iso_8601": "2024-08-23T22:18:03.825496Z",
            "url": "https://files.pythonhosted.org/packages/5c/56/269824e8ae46772c3506c72ece58148f13e65a2ffaed42c5bd428960a729/django_dbbackup-4.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e93180d0fcf0d7da8bcaca7aeb6ba27490bd18132d8c625b2c1a1c8f03516bf",
                "md5": "ae3373d7d405a3be6f1ab8ef3cfe4f42",
                "sha256": "157a2ec10d482345cd75092e510ac40d6e2ee6084604a1d17abe178c2f06bc69"
            },
            "downloads": -1,
            "filename": "django_dbbackup-4.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ae3373d7d405a3be6f1ab8ef3cfe4f42",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 44876,
            "upload_time": "2024-08-23T22:18:05",
            "upload_time_iso_8601": "2024-08-23T22:18:05.061740Z",
            "url": "https://files.pythonhosted.org/packages/6e/93/180d0fcf0d7da8bcaca7aeb6ba27490bd18132d8c625b2c1a1c8f03516bf/django_dbbackup-4.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-23 22:18:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jazzband",
    "github_project": "django-dbbackup",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "django",
            "specs": [
                [
                    ">=",
                    "3.2"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "django-dbbackup"
}
        
Elapsed time: 0.37614s