On Tuesday, June 1, 2021 at 1:45:29 PM UTC+2 Aymeric Augustin wrote: > I would recommend running without persistent database connections > (CONN_MAX_AGE = 0) and switching settings.DATABASE["default"] in a > middleware at the beginning of every request. Modifying settings at runtime > isn't officially supported, but this looks like the closest option to the > intent you expressed. >
Funny that you should mention this. I thought about this when doing something similar for ARA, but settled down on a custom database backend: https://github.com/ansible-community/ara/blob/master/ara/server/db/backends/distributed_sqlite/base.py -- it does work surprisingly well and I think it might be more resilient than settings shenanigans. Not that I am particularly proud of that backend but I thought I'd share it here for the off-chance someone finds your post via a search engine and wonders how to implement such a thing. Cheers, Florian -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/42ea1452-8699-41f5-b6c8-2b2d319477den%40googlegroups.com.