Skip to main content

A backend for Django and Postgres that sets up a readonly connection

Project description

A readonly database backend for Django and PostgreSQL. It does this by setting the connection to “readonly”.

Usage

To configure a read-only database connection, add an entry to your DATABASES setting that uses django_postgres_readonly as the engine:

DATABASES = {
    'default': {
        'NAME': 'my_django_db',
        'ENGINE': 'django.db.backends.postgresql',
        'USER': 'my_db_user',
        'PASSWORD': 'my_password'
    },
    'readonly': {
        'NAME': 'my_django_db',
        'ENGINE': 'django_postgres_readonly',
        'USER': 'my_db_user',
        'PASSWORD': 'my_password'
    }
}

Caveats

This backend is not meant to provide security against willful bad actors. Its main reason of existence is to protect you against your own mistakes.

If you need secure way for read-only connections, you should probably look into creating a separate user and grant it SELECT rights only.

Project details


Release history Release notifications

Download files

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

Files for django-postgres-readonly, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size django_postgres_readonly-1.0.0-py2.py3-none-any.whl (3.8 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size django-postgres-readonly-1.0.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page