Management command to reset your Django database
Project description
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:
Add django_resetdb to your INSTALLED_APPS (./manage.py help should now list django-resetdb)
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 DB_NAME --no-migrate
If there is an existing database backup you wish to reset to, you can use that instead:
$ ./manage.py resetdb --clone DB_DUMP_PATH --no-migrate
Drop database
Drop your default database:
$ ./manage.py dropdb --force
Create database
Create your default database:
$ ./manage.py createdb
Dump database
Dump your default database to a file:
$ ./manage.py dumpdb PATH_TO_DUMP
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
Built Distribution
File details
Details for the file django_resetdb-0.2.2.tar.gz
.
File metadata
- Download URL: django_resetdb-0.2.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 818fdc83755343d475b5cf8daa3d7ebe8b7a697225ed2916b569d42c4d2e054b |
|
MD5 | 7ed9502acc0edc313ab62646a53dba2e |
|
BLAKE2b-256 | 11382a475140e1a2c38e982651083ee9fc34ac36b4289074dff01ca90a4556a3 |
File details
Details for the file django_resetdb-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: django_resetdb-0.2.2-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b4b3ce74dc18e9a4b58238bd250d134be12e755bca7699e46302ad175c68c2 |
|
MD5 | b6ac3414785368d8150cf7d7079c90b1 |
|
BLAKE2b-256 | ec648159dcd15d556342881c70f00034c7035829b784a5b5a4f86b9fa37c4631 |