django-read-only
Disable Django database writes.
Decision gist · record as of 2026-08-14
Yes. This is a lightweight, actively maintained package with no security vulnerabilities that solves a real operational safety problem—preventing accidental database modifications in interactive sessions. The low install friction (one dependency), permissive MIT license, and production-stable status make it a practical choice for teams running Django in production or staging environments where shell access is common.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django 4.2 to 6.0 and Python 3.9 or later.
- Cannot block queries executed directly through the underlying database connection or stored procedures.
- Low friction installation with a single runtime dependency on Django.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.
last release 2025-09-18 (330 days) · last repo commit 2026-08-04 · 111 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 125,021 downloads/mo, #11,841 on PyPI
Alternatives
Verify before relying
pip install django-read-only
# Add to INSTALLED_APPS in settings.py
INSTALLED_APPS = [..., "django_read_only", ...]
# Enable via environment variable or setting
DJANGO_READ_ONLY = True
# In shell, writes are now blocked; re-enable with:
import django_read_only
django_read_only.enable_writes()- Performance overhead of query inspection during read-only sessions is not quantified in the fact sheet.
- Compatibility with custom database backends or non-standard query patterns beyond standard Django ORM is unclear.
What it is and what it does
django-read-only is a Django package that enforces read-only mode on your database by intercepting and rejecting data modification queries. It works by inspecting executed queries at the Django database instrumentation layer and raising an exception when a write is detected. The package is designed for interactive sessions—particularly shell environments in production or staging—where developers need to run exploratory queries without risking accidental data changes.
You control read-only mode via a setting or environment variable, and can temporarily or permanently re-enable writes within a session using provided functions and context managers. It also integrates with IPython as an extension for quick toggling. The package uses a "fail closed" philosophy, meaning unknown query patterns are blocked to be safe. Note that it cannot intercept queries bypassing Django's ORM entirely or operations within stored procedures.
Use it for
- Enable read-only mode in production shell sessions to prevent developers from accidentally modifying data during exploratory queries.
- Protect staging environments during interactive debugging by blocking write queries while allowing reads.
- Temporarily allow writes within a context manager to run a specific management command or data fix without disabling read-only mode globally.
- Use the IPython extension to quickly toggle read-only mode on and off during interactive development sessions.
- Enforce a safe-by-default policy where writes are disabled in interactive shells but remain enabled for automated processes like WSGI servers.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a lightweight, actively maintained package with no security vulnerabilities that solves a real operational safety problem—preventing accidental database modifications in interactive sessions. The low install friction (one dependency), permissive MIT license, and production-stable status make it a practical choice for teams running Django in production or staging environments where shell access is common.
Install
django-read-only on PyPI
Before you install
Low friction installation with a single runtime dependency on Django. The package is actively maintained with recent releases and no known vulnerabilities.
Requires Django 4.2 to 6.0 and Python 3.9 or later. Cannot block queries executed directly through the underlying database connection or stored procedures.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.
Quickstart
pip install django-read-only
# Add to INSTALLED_APPS in settings.py
INSTALLED_APPS = [..., "django_read_only", ...]
# Enable via environment variable or setting
DJANGO_READ_ONLY = True
# In shell, writes are now blocked; re-enable with:
import django_read_only
django_read_only.enable_writes()
Verify before relying
- Performance overhead of query inspection during read-only sessions is not quantified in the fact sheet.
- Compatibility with custom database backends or non-standard query patterns beyond standard Django ORM is unclear.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedjango |
| Maintenance | Actively maintained 330 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 125,021 / month, #11,841 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: IPythonIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTyping :: Typed |
Evidence: django_read_only-1.21.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django read-only mode”
- django-read-onlyPrevents Django database write operations by intercepting and…
- django-pgtriggerdjango-pgtrigger lets you define PostgreSQL triggers declaratively on…
- django-map-widgetsProvides interactive and static map widgets for Django GeoDjango form…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also django-pgtrigger · django-pgmigrate · django-dirtyfields · django-guardian · atomicwrites · django-zen-queries · drf-access-policy · DrissionRecord · django-constance · django-upgrade