Skip to main content

A read only mode tool for your database

Project description

Django Db Tools is a set of Database tools that are helpful when running applications with Django in production. The primary initial tool allows for flipping a site in and out of a read-only mode.

Currently the following functionality is being worked on:

  • A header displaying the read only mode

  • Ability to render a template explaining posts are not allowed

Installation

  1. Add the db_tools directory to your Python path.

  2. Add the following middleware to your project’s settings.py file:

    MIDDLEWARE_CLASSES = (
        # ...
        'dbtools.middleware.ReadOnlyMiddleware',
        # ...
    )

Configuration

The db tools has two modes which you can control:

  1. READ_ONLY_MODE

This mode ensures all users even if already logged in act as anonymous users on your site. To enable this you need to set the following environment variable:

READ_ONLY_MODE = True

  1. GET_ONLY_MODE

This mode disallows all POST requests to your site. If your site only allows inserting data as POSTS then this should be sufficient to allow your users to view their data, but also ensure no new data is written. To enable this set the following environment variable:

GET_ONLY_MODE = True

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-db-tools-0.0.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file django-db-tools-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-db-tools-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f903bb174df9c9a22c7e3c186659470f3a4150667388992d6e68f8afbcf3e6ea
MD5 648eb0d8b150f7bbf38e0c85ca05cb68
BLAKE2b-256 1e8cc9dfcd27edf80ee708091c4c9bb2f67f88ac79f31293d0fdd9852e4785a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page