Skip to main content

Management command to reset your Django database

Project description

# django-resetdb

Developer-friendly database resets for Django

## Motivation

You’re developing a Django project and you need to investigate a problem in production. So, you need to clone the production database and take a look at it.

In the olden days, this was a very manual process. You would try to find a wiki page, forget where it is, try to remember the commands you needed to do, probably forget some minor detail, and, eventually, you would get your database clone.

Instead, you can now run a single command to either reset your database to a blank state or clone another database (production or otherwise).

## Installation

### Via internal PyPI

First you’ll need to make sure that your pip has knowledge of our internal PyPI repository. Then simply:

$ pip install django-resetdb

### Manual Installation

$ git clone https://github.com/GreenBankObservatory/django-resetdb $ pip install django-resetdb

## Configuration

Two settings will need to be configured before use:

  1. Add django-resetdb to your INSTALLED_APPS (./manage.py help should now list django-resetdb)

  2. Add django-resetdb to your LOGGING, if you want to access its verbose modes (optional)

## Usage

### Reset to blank database

In its most basic form, resetdb will simply reset your database to a blank state and apply migrations:

$ ./manage.py resetdb

### Reset to a database clone

This allows you to reset your database to a clone of another. You also have the option of avoiding migrations at the end (we need this for DSS currently, I think):

If you want to clone a database, you could simply provide the database name you wish to clone:

$ ./manage.py resetdb –clone dss_production –no-migrate

If there is an existing database backup you wish to reset to, you can use that instead:

$ ./manage.py resetdb –clone /home/scratch/dss/database_backups/dss_production.2018-06-08_00:00:00 –no-migrate

Project details


Download files

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

Source Distribution

django-resetdb-0.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

django_resetdb-0.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file django-resetdb-0.2.0.tar.gz.

File metadata

File hashes

Hashes for django-resetdb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3e935d417a0a08e38338fad7b468f8b750fdd309c9eb23113f59b15c438a35da
MD5 2fd2a6a9c32841dd22ebde0beacb1ee5
BLAKE2b-256 09dda4ef9ae29c843195cecb0b2c82afd7405f8639aaa58e6a7d73cf78a42e62

See more details on using hashes here.

File details

Details for the file django_resetdb-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_resetdb-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4cea0c59720bb01dcc2d04af63759586651c5516f50558997560525fa6bbb541
MD5 2a49df1035ed20e6535d4f0d14cc3ef6
BLAKE2b-256 4c99c1cebe4ec9f90e2509aca2a40b1b3f605286b230b1666651ed6f7c0ec8c1

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