I recommend the "try expect:" in main.py, it's pretty easy. I have
been using this:

try:
  ...
except:
  import os

  if os.environ.get('SERVER_SOFTWARE','').startswith('Goog'):
    from google.appengine.api import xmpp
    import traceback
    import logging

    msg = "Exception during app startup:\n\n"
    tb_txt = msg + traceback.format_exc()

    user_gtalk = '[email protected]'
    if xmpp.get_presence(user_gtalk):
      xmpp.send_message(user_gtalk, tb_txt)

    logging.critical(tb_txt)
    raise
  else:
    raise

On May 25, 10:30 pm, jonmidd <[email protected]> wrote:
> How do we best cope with these exceptions?
>
> Currently my app is failing to import a file in the top most url.py
> file due to a google.appengine.runtime.DeadlineExceededError
> exception.
>
> I am using Django, is there a top most place I can catch all
> exceptions and display a custom 500 message to the user?
>
> Currently they get the uncaught exception message which is not ideal.
>
> Do I have to put a try catch statement around the imports in the
> url.py file?
>
> Or is it best to add this to the main.py
>
> def main():
>   try:
>     # Create a Django application for WSGI.
>     application = django.core.handlers.wsgi.WSGIHandler()
>
>     # Run the WSGI CGI handler with that application.
>     util.run_wsgi_app(application)
>   except:
>     from django.shortcuts import render_to_response
>     return render_to_response( '500.html' )
>
> Thanks.
>
> On May 26, 7:58 am, Andrew Cebulski <[email protected]> wrote:
>
>
>
> > +1 Google Apps Short Links (runs Python) down too...

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to