Like most things, I’m probably the last to know about this, but it’s very useful.
When I’m locally developing Django applications which use SMTP, I usually get stuck in a cycle which goes: make request, send, wait, check inbox, wait, wait, there-it-is, oh, it’s wrong, I’ve wasted 3 minutes. Annoying.
This snippet runs a local SMTP server, which echoes all incoming mail to stdout, instantly:
Note that sudo is only required to run it on the standard low port, but you can specify a different port number in settings.py if you don’t have privileges.
I’ve been working on a couple of snippet collections for yasnippet recently, which I never got around to writing about.
First is yasnippet-licenses, which contains a set of short and long-form FSF licenses. It should suit the fastidious, who like to license each file correctly.
Second is yasnippet-django, which is a fairly comprehensive set of snippets from Django 1.0 models, forms and templates. It isn’t my own work, just a conversion of the excellent set of TextMate snippets by Brian Kerr.
I get quote a lot of traffic to my entry on encrypting Paypal buttons with Django. I was pleased to see that John Boxall has created django-paypal, a nice clean pluggable Django application for dealing with Paypal payments in Django projects which uses a few of the ideas I developed in my original post.
Hopefully this means that I can move a little bit quicker on a few projects I’m working on, like the Mampi payment system.
I always have to look up which permissions a user needs to just run mysqldump successfully. This creates a new backup user, without a password, and gives them the least amount of privilege necessary.
CREATE USER 'backup'@ 'localhost';GRANT SHOW DATABASES, SELECT, LOCK TABLES, RELOAD ON *.* to backup@localhost;FLUSH PRIVILEGES;