Reputation: 15320
I'm using the latest tools provided by the latest Google App Engine (GAE) environment, i.e. Django 1.3 via
libraries:
- name: django
version: "1.3"
as instructed by the GAE docs here.
Still, although I found a lot of links discussing how to send the blessed HTTP500 email using the powerful GAE-Django combo, all of them are outdated because they are either simply too old or use "additional" tools like AppEngineHelper or django-nonrel.
Back to my problem: I set up my settings.py
to follow the Django docs instructions here, and since on GAE opening sockets is restricted I end up with this traceback:
ERROR 2012-03-21 23:11:15,855 base.py:209] Internal Server Error: /contact/
Traceback (most recent call last):
File "/home/josvic/dev-tools/google_appengine/lib/django_1_3/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/josvic/dev/qdsa/gae/apputil/decorators.py", line 14, in wrapper
output = func(request, *args, **kw)
File "/home/josvic/dev/qdsa/gae/qdcom/views/contact.py", line 26, in __call__
return self.f(request, *args, **kwargs)
File "/home/josvic/dev/qdsa/gae/qdcom/views/contact.py", line 59, in contact_page
msg.send()
File "/home/josvic/dev-tools/google_appengine/lib/django_1_3/django/core/mail/message.py", line 251, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/josvic/dev-tools/google_appengine/lib/django_1_3/django/core/mail/backends/smtp.py", line 79, in send_messages
new_conn_created = self.open()
File "/home/josvic/dev-tools/google_appengine/lib/django_1_3/django/core/mail/backends/smtp.py", line 42, in open
local_hostname=DNS_NAME.get_fqdn())
File "/home/josvic/dev-tools/google_appengine/lib/django_1_3/django/core/mail/utils.py", line 16, in get_fqdn
self._fqdn = socket.getfqdn()
AttributeError: 'module' object has no attribute 'getfqdn'
So that is the problem. Do we have a standard way of circumventing this?
The only thing I can think of to bypass this problem is to resort to a custom 500error
handler that uses GAE's standard mail API.
Upvotes: 1
Views: 494
Reputation: 15143
Two options I can think of are:
Custom logging handler that uses GAE standard mail API, not too different from a 500 error handler, but you don't have to rewrite the view: https://docs.djangoproject.com/en/dev/topics/logging/
Replace the email backend. I'm not 100% certain this works, but I suspect it will. There's already one in the Django-nonrel project (which incidentally, is still maintained) https://github.com/django-nonrel/djangoappengine look in mail.py
Upvotes: 1