Re:Fixing Database Connections in Django
by est on Saturday March 09, 2013 @12:40AM
(#5347523)
I think Django db connection are doing it plain wrong. Connection are established and gone with a request, but in fact we can simply use a global variable for any SQL/NoSQL connection pool in views.py, which is basically a WSGI global variable.
In this case, connections are established when a gunicorn/uWSGI worker process starts, and shutdown when the worker is respawned.
Re:Fixing Database Connections in Django
by jeremyw on Saturday March 09, 2013 @12:44AM
(#5347532)
Right, the problem is all the failure modes. You want a battle-tested library that hands you a valid connection, that will work to the 99th percentile. Lots of edge cases.
In this case, connections are established when a gunicorn/uWSGI worker process starts, and shutdown when the worker is respawned.