Re: Reconnecting after a database restart

2011-01-11 Thread Brennan Sellner
On Mon, 2011-01-10 at 09:09 -0800, Euan Goddard wrote: > As far as I know Django maintains a persistent connection to the > database server and restarting the server without restarting the > client isn't possible. We never restart our live database server in > production (we fail over to a secondar

Re: Reconnecting after a database restart

2011-01-10 Thread Jirka Vejrazka
Hi Brennan, You can force Django to reopen the database connection by: >>> from django.db import connection >>> connection.close() Django will then automatically reconnect to the database when it needs it. Obviously, it's up to you to figure out where to put this code in your application (it mig

Re: Reconnecting after a database restart

2011-01-10 Thread Euan Goddard
As far as I know Django maintains a persistent connection to the database server and restarting the server without restarting the client isn't possible. We never restart our live database server in production (we fail over to a secondary server so that the app is essentially only vulnerable for a f

Reconnecting after a database restart

2011-01-10 Thread Brennan Sellner
Hi folks, We're using the Django database layer as part of a Twisted application [1], and we're having some problems with Django failing to reconnect to the database after the database server restarts. It works great otherwise, but once the database server restarts, the Django database layer thro