1

I have set 404 error reporting on Django 1.6 by adding, django.middleware.common.BrokenLinkEmailsMiddleware at MIDDLEWARE_CLASSES. I have placed it first since some of other middleware classes may interrupt. However, I am not receiving 404 errors.

EMAIL_USE_TLS =
EMAIL_HOST =
EMAIL_HOST_USER =
EMAIL_HOST_PASSWORD =
EMAIL_PORT =

Above are my email setting and have been tested.

It is annoying since on my local environment one of generic views is working however not on production and I just receive 404 without knowing the actual error.

Any suggestions please?

Uma
  • 689
  • 2
  • 12
  • 35
  • Those are obviously not your email settings. What is your question? – garnertb Jan 03 '15 at 15:57
  • possible duplicate of [Django emailing on errors](http://stackoverflow.com/questions/11589124/django-emailing-on-errors) – garnertb Jan 03 '15 at 15:59
  • @garnertb I have appropriate values defined against each of the email setting. My question is that I am not receiving 404 error emails. – Uma Jan 03 '15 at 16:02
  • Also, I have defined ADMINS and MANAGERS and also EMAIL_BACKEND. So this question is not a duplicate of http://stackoverflow.com/questions/11589124/django-emailing-on-errors – Uma Jan 03 '15 at 16:09
  • Those are relevant settings that you need to include in the question. – garnertb Jan 03 '15 at 16:41
  • Does your DEBUG=False? – garnertb Jan 03 '15 at 16:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/68145/discussion-between-codingmehelp-and-garnertb). – Uma Jan 03 '15 at 18:52

1 Answers1

2

According to the documentation, Django will only send broken link emails when DEBUG=False and BrokenLinkEmailsMiddleware appears before other middleware that intercepts 404 errors. So ensure that django.middleware.common.BrokenLinkEmailsMiddleware is first in your MIDDLEWARE_CLASSES tuple. If you have both of those settings correct, ensure that you can send an email using Django's mail_managers function (https://docs.djangoproject.com/en/1.7/topics/email/#mail-managers) via the Django shell.

garnertb
  • 9,454
  • 36
  • 38
  • I ran mail_managers function through shell and got this message; **% (desc, ENVIRONMENT_VARIABLE)) django.core.exceptions.ImproperlyConfigured: Requested setting MANAGERS, but set tings are not configured. You must either define the environment variable DJANGO _SETTINGS_MODULE or call settings.configure() before accessing settings.** – Uma Jan 03 '15 at 18:52
  • Didn't understand why was the question given -1. This question is not a duplicate nor did the answer given helped in anyway. – Uma Jan 03 '15 at 20:04
  • ok. I guess someone was feeling funny today. Thanks for your help so far. – Uma Jan 03 '15 at 20:53