django-db-readonly icondjango-db-readonly 0.3.0

Add a global database read-only setting
django-db-readonly is a Django app that provides an way to globally disable writes to your database. This works by inserting a cursor wrapper between Django's CursorWrapper and the database connection's cursor wrapper. So many cursor wrappers!

Installation:

I uploaded it to PyPi, so you can grab it there if you'd like with

pip install django-db-readonly

or install with pip the git address:

pip install git+git@github.com:streeter/django-db-readonly.git

You're choice. Then add readonly to your INSTALLED_APPS.

Usage:


You shouldn't notice this at all, unless you add the following line to your settings.py:

# Set to False to allow writes
SITE_READ_ONLY = True


When you do this, any write action to your databases will generate an exception. You should catch this exception and deal with it somehow. Or let Django display an error 500 page. The exception you will want to catch is readonly.exceptions.DatabaseWriteDenied which inherits from django.db.utils.DatabaseError.

last updated on:
May 23rd, 2011, 14:17 GMT
price:
FREE!
developed by:
Chris Streeter
license type:
BSD License 
category:
ROOT \ Internet \ Django Plugins

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Add your review!

SUBMIT