Question

I am running django 1.5 on ubuntu 13.04 with apache2 and mod_wsgi locally. Requests that return a 200 status code (no errors) are really fast (~50ms) however if there is an error either in the view etc. or the template, the request takes 2-3 minutes and then shows the traceback as expected.

I tried the test server and got the same results so that suggests the serving of the app isn't at fault. In that case, I assume it's the configuration however since after each change I have to wait 2-3 minutes, I thought I'd ask if anyone has any ideas of the cause or has experienced this before?

It turns out that it was hanging all that time trying to send the error report to MAIL_ADMINS with SMTP however I have DEBUG=True in my settings so it shouldn't be sending error emails... still investigating why that is happening.

Was it helpful?

Solution

The two issues were:

  1. require_debug_false filter was inadvertently missing from the mail_admins logging

    handler: ...
        'handlers': { ...
            'mail_admins': {
               'filters': [''],
    

    should have specified:

    'filters': ['require_debug_false'],
    
  2. As a result, even with DEBUG=True Django would attempt to send an error email to mail_admins however the settings were only configured to work with the SMTP mail server in a staging or production environment so it was hanging trying to connect to the mail server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top