Search code examples
pythondjangomandrill

Python Django Mandrill API response 500


I've been looking at this problem and am stuck in the follwing Python.

https://github.com/miohtama/LibertyMusicStore

It uses Django which in turn uses Mandrill for emails via the Python package Djrill. It was set up and working but after the SSL cert was updated it was noted that the signup no longer worked but generated a '500 Server Error' message. The log for this event is copied in below.

A new MailChimp account was set up with Mandrill added, I created a new API key and updated the MANDRILL_API_KEY entry. On Mandrill the domain, SPF and DKIM has been verified but it still does not work. I'm not familiar with this software and I'm sure this is simple if you know how. If I look at the Mandrill API logs they are completely blank which makes me think that I'm missing some configuration somewhere, like changing the API key is not enough to change Mandrill account.

This is the page which generates the problem when the form is submitted.

http://music.artbyte.me/musician-sign-up/

Any ideas on what I am doing wrong?

INFO 2017-01-28 09:07:48,278 connectionpool 86.142.174.63 - POST /signup/ HTTP/1.1" Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Starting new HTTP connection (1): mandrillapp.com
ERROR 2017-01-28 09:07:48,418 base - - - - -" - Internal Server Error: /signup/
Traceback (most recent call last):
File "/srv/django/applebytestore/venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/srv/django/applebytestore/venv/lib/python3.4/site-packages/django/db/transaction.py", line 394, in inner
return func(*args, **kwargs)
File "./tatianastore/signup.py", line 116, in signup
File "./tatianastore/signup.py", line 103, in create_user
File "./tatianastore/emailer.py", line 22, in mail_store_owner
msg.send()
File "/srv/django/applebytestore/venv/lib/python3.4/site-packages/django/core/mail/message.py", line 286, in send
return self.get_connection(fail_silently).send_messages([self])
File "/srv/django/applebytestore/venv/lib/python3.4/site-packages/djrill/mail/backends/djrill.py", line 68, in send_messages
sent = self._send(message)
File "/srv/django/applebytestore/venv/lib/python3.4/site-packages/djrill/mail/backends/djrill.py", line 119, in _send
(msg_dict['to'], msg_dict['from_email']))
djrill.exceptions.MandrillAPIError: Mandrill API response 500
Failed to send a message to [{'name': '', 'email': '[email protected]', 'type': 'to'}], from [email protected]

Solution

  • The djrill docs say that the project has been inactive since April 2016. They suggest that you use django-anymail instead.

    When you update Python code in production, you need to restart the server (e.g. Apache or gunicorn) for the changes to take effect.