Metadata-Version: 2.5
Name: django-snapshots
Version: 0.1.0b1
Summary: A generic and pluggable backup and restore management utility for Django.
Project-URL: Homepage, https://django-snapshots.readthedocs.io
Project-URL: Documentation, https://django-snapshots.readthedocs.io
Project-URL: Repository, https://github.com/bckohan/django-snapshots
Project-URL: Issues, https://github.com/bckohan/django-snapshots/issues
Project-URL: Changelog, https://django-snapshots.readthedocs.io/en/latest/changelog.html
Project-URL: Code_of_Conduct, https://github.com/bckohan/django-snapshots/blob/main/CODE_OF_CONDUCT.md
Author-email: Brian Kohan <bckohan@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: django
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <4.0,>=3.8
Requires-Dist: asyncer>=0.0.11
Requires-Dist: django-typer>=2.2.2; python_version < '3.9'
Requires-Dist: django-typer>=3.4.0; python_version >= '3.9'
Requires-Dist: django<6.2,>=4.2
Requires-Dist: python-dateutil>=2.8.0
Requires-Dist: tqdm>=4.62.0
Requires-Dist: typing-extensions>=4.0.0
Description-Content-Type: text/markdown

# django-snapshots
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![PyPI version](https://badge.fury.io/py/django-snapshots.svg)](https://pypi.python.org/pypi/django-snapshots/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/django-snapshots.svg)](https://pypi.python.org/pypi/django-snapshots/)
[![PyPI djversions](https://img.shields.io/pypi/djversions/django-snapshots.svg)](https://pypi.org/project/django-snapshots/)
[![PyPI status](https://img.shields.io/pypi/status/django-snapshots.svg)](https://pypi.python.org/pypi/django-snapshots)
[![Documentation Status](https://readthedocs.org/projects/django-snapshots/badge/?version=latest)](http://django-snapshots.readthedocs.io/?badge=latest/)
[![Code Cov](https://codecov.io/gh/bckohan/django-snapshots/branch/main/graph/badge.svg)](https://codecov.io/gh/bckohan/django-snapshots)
[![Test Status](https://github.com/bckohan/django-snapshots/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/bckohan/django-snapshots/actions/workflows/test.yml?query=branch:main)
[![Lint Status](https://github.com/bckohan/django-snapshots/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/bckohan/django-snapshots/actions/workflows/lint.yml?query=branch:main)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/bckohan/django-snapshots/badge)](https://securityscorecards.dev/viewer/?uri=github.com/bckohan/django-snapshots)

A generic and pluggable backup and restore management utility for Django.

Back up your databases, `MEDIA_ROOT` and Python environment into a single,
checksummed snapshot, and restore it with one command.

**This is a beta release.** The CLI and settings are stabilizing but may still change before 1.0.

## Features

- Native, consistent dumps for SQLite, PostgreSQL and MySQL/MariaDB, with a `dumpdata` fallback for any other backend.
- Snapshots stored as a directory or as a single `.tar` archive, on the local filesystem or any Django storage backend.
- SHA-256 checksums for every artifact, all verified before any data is restored.
- Retention policies (`keep`, `duration`, `max_size`) for pruning old snapshots.
- A read-only Django admin page for browsing the snapshots in storage.
- Pluggable: add your own artifact types, database connectors and storage backends.

## Installation

```bash
pip install django-snapshots
```

```python
INSTALLED_APPS = [
    ...
    "django_snapshots",
    "django_snapshots.backup",
    "django_snapshots.restore",
]

# optional, snapshots go to ./snapshots by default
SNAPSHOTS = {
    "STORAGE": {
        "BACKEND": "django_snapshots.storage.LocalFileSystemBackend",
        "OPTIONS": {"location": "/var/backups/snapshots"},
    },
}
```

Then run `python manage.py migrate` (django-snapshots adds one always-empty table that backs its admin page and permission).

## Usage

```bash
python manage.py snapshots backup                       # databases + media + environment
python manage.py snapshots backup --name pre-deploy database
python manage.py snapshots list
python manage.py snapshots restore --name pre-deploy    # or omit --name for the latest
python manage.py snapshots prune --keep 10
```

## Documentation

Full documentation is available at [django-snapshots.readthedocs.io](https://django-snapshots.readthedocs.io).


## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md).
