django-db-readonly

Add a global database read-only setting
Download

django-db-readonly Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Publisher Name:
  • Chris Streeter
  • Publisher web site:
  • http://chrisstreeter.com

django-db-readonly Tags


django-db-readonly Description

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 withpip install django-db-readonlyor install with pip the git address:pip install git+git@github.com:streeter/django-db-readonly.gitYou'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 writesSITE_READ_ONLY = TrueWhen 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. Requirements: · Python · Django


django-db-readonly Related Software