Experiences writing an ActivityPub server in Python with Django
This post is about how I wrote an ActivityPub server using the Django Python framework, to provide a fediverse account on the same domain as a WordPress blog.
On The Aperiodical, we do a monthly post collecting bits of maths news that we've seen. This is the compromise we came to as we realised that we're too old and busy to keep up with writing in-depth posts about individual things any more.
When we started doing this, I set up a
/news slash command in our Slack channel which would take a URL and some explanatory text, and add it to the current draft post.
Slack insists you give a username to the account that replies to this command, so we have our happy little Aperiodipal secretary.
Since we only publish the news posts once a month, we sometimes miss out on spreading the word about time-limited events, such as deadlines to register for conferences or mathematical holidays. And when there's Big Maths News such as a proof of an old conjecture, it'd be nice to put something out immediately rather than waiting until it's old news.
So I thought it would be a good idea to automatically toot on the fediverse each time one of us adds an item to the news post, as part of the
/news Slack command.
Ideally, I'd like the fediverse account to belong to the aperiodical.com domain, instead of a Mastodon instance such as mathstodon.xyz.
That meant I'd have to serve the ActivityPub protocol on aperiodical.com. This is the kind of thing you do when really you're more curious about how the protocol works than making a pragmatic decision of the best course of action.