Open domenkozar opened 12 years ago
Yeah, I've wanted this too. The thing that is tricky about it is you don't want to write to the database to turn if off. So you need another way to persistently store the setting. Memcache could be an option, but it isn't the best option.
Maybe just check if specific file exists?
On Mon, Sep 5, 2011 at 12:28 AM, streeter < reply@reply.github.com>wrote:
Yeah, I've wanted this too. The thing that is tricky about it is you don't want to write to the database to turn if off. So you need another way to persistently store the setting. Memcache could be an option, but it isn't the best option.
Reply to this email directly or view it on GitHub:
https://github.com/streeter/django-db-readonly/issues/1#issuecomment-1994271
You can use django-constance for dynamic settings. I realize this might only be a good option for those who already have redis running.
https://github.com/streeter/django-db-readonly/pull/22 starts the process, allowing turning it on and off programatically, and there is a note there for how we might be able to have it per-connection instead of all connections.
If we can make it per-connection, the default connection could be turned off, and another connection used only for this app using per-app routing. c.f. https://github.com/just-work/django-database-routing and many other db routers that support that.
Goal is to avoid restarting server instance