Skip to main content

No project description provided

Project description

Django PostgreSQL Copy

The package django-pg-copy provides Django management commands for backing up and restoring PostgreSQL databases. These were developed for copying production databases to development, to allow developers to share images with one another, or bring local development databases up to date.

Installation

pip install django-pg-copy

Then add 'pg_copy', to your INSTALLED_APPS list. It is recommended that it is used in all environments (development, production) so that you can use it against different instances of your database.

Settings

PG_COPY_BACKUP_PATH = 'db_backup'

By default, PostgreSQL backups will be stored in a directory called db_backup where you run the command. This setting will override that location.

It is also recommended to add this path to your .gitignore file, if the path falls under your version control repository.

Example Commands

python manage.py pg_backup --settings=config.settings.production --database=default --filename=my_backup.sqlc

This command will create a backup in the same directory as manage.py called my_backup.sqlc using the default settings from DATABASES using the Django settings file config.settings.production.

python manage.py pg_backup

This command will create a backup in the directory ./db_backup/ (or the directory you specified with PG_COPY_BACKUP_PATH) called [timestamp].sqlc using the default settings from DATABASES using the default Django settings file resolved by manage.py.

python manage.py pg_restore

This command will provide a list of backup files in PG_COPY_BACKUP_PATH that can be restored. After selecting a backup file, it will confirm that the user wants to overwrite the destination database by showing which server and database will be overwritten from the settings.

python manage.py pg_restore --filename=my_file.sqlc

This command will read the file my_file.sqlc and confirm that the user wants to overwrite the destination database by showing which server and database will be overwritten from the settings.

Contributors

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-pg-copy-0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

django_pg_copy-0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file django-pg-copy-0.1.tar.gz.

File metadata

File hashes

Hashes for django-pg-copy-0.1.tar.gz
Algorithm Hash digest
SHA256 53bacb8aebf3f0f9b13a73c3649a1bca688a2b7e6adcbd7146f5a47d53179f0f
MD5 c7feae20f0183521b08197b6f74ca6cd
BLAKE2b-256 f52f5b11b14c0483cef7fb237dc38bc2d1778290f6c8091be61004c6774d841a

See more details on using hashes here.

File details

Details for the file django_pg_copy-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_pg_copy-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02bf16866486a372a16876f8772b195aa7d91c27d69c987d40942bdf42060ec1
MD5 9a823251a85dea12593fac31be96917b
BLAKE2b-256 64e494194e09fab299b9eb3820b73197fc4215f8b6e271f42284dc1bb938339e

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