I'm hoping for a recommendation for dealing with the (rare) exception that could happen during initial application loading which ends up corrupting the application.
While rare, I've seen that, for example, an unfortunately-timed database disconnection which happens to occur during initial application load and configuration, but after most other configuration leads to an unusable wsgi process (it is half-cooked). All subsequent requests Apache sends to this process attempts to load the application (again) but it is in a state which causes an exception every time (because it was partly already configured).
I've considered wrapping the delicate start-up code section in a try-except block that would signal itself for termination so that Apache restarts that child:
os.kill(os.getpid(), signal.SIGINT)
But I wanted to check whether there is a "preferred" or better approach to dealing with this circumstance?
Thanks in advance!
Kent