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


Download files

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

Source Distribution

django-postgres-readonly-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

django_postgres_readonly-1.0.0-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-postgres-readonly-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django-postgres-readonly-1.0.0.tar.gz
Algorithm Hash digest
SHA256 198eef0319f72225c23786203c4520a3a249bb4d83bd9066b2ac1c550073433c
MD5 ee96e93b4c9d4b7fa40ee5e11ab19ab2
BLAKE2b-256 53bed210ccece0088aec806d209afa80249cce953b007909421091a30fdf8cdc

See more details on using hashes here.

File details

Details for the file django_postgres_readonly-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_postgres_readonly-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 114e158ca38a157b7453d614aa9a9fd82646f0b5a91bbe0a496c4b3a1a852dfc
MD5 45d705d33ffe9791a478f16e13b434db
BLAKE2b-256 a5fa99acbc56aae92cf9d1b48da42a6685178c4b90a62cdcf5e677728f8255de

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