Ephes Blog

Miscellaneous things. Mostly Weeknotes and links I stumbled upon.


TIL: Setting up a Mastodon Instance

, Jochen

This was easier than expected. For the most part, I followed the official "Installing from source" documentation. But there were some differences, too. Therefore writing this up might be useful for someone with a similar setup.

The Stack I Used

  • Ansible to set up the user account / database / config files
  • Traefik as a reverse proxy load-balancer also handling SSL termination and gzip compression


Weeknotes 2022-11-21

, Jochen
"Better to sink in boundless deeps, than float on vulgar shoals; and give me, ye gods, an utter wreck, if wreck I do." —Mardi

Lots of stuff happened last week besides work. After we finally found time to meet for some podcasting the week before last week, I finished producing our podcast episode about Python 3.11 😎.

Last week I wondered how long it will take to migrate the content after being able to deploy my new wagtail-based django-cast version. Turns out it didn't take that long, because now both this website and python-podcast.de are running the latest Python/Django/Wagtail combination. Ok, I have to admit it was a lot of work, and I broke some stuff, but now it's done. Finally 🍾! I started this project around 2019, so long ago that I don't even remember exactly when!

Articles

Weeknotes

Software

Podcasts


Out of Context Images

No images this week, I was busy sitting inside staring at computer screens.


TIL: Be careful with your wagtail javascript

, Jochen

Currently I'm busy replacing my home grown content editing solution for my blog software django-cast with Wagtail. I copied the javascript part needed for the wagtail admin to add audio blocks from the video javascript and forgot to replace all occurrences of videoTitle with audioTitle. Besides being wrong this worked for Wagtail2.

But last week I upgraded to Wagtail4 and now audio blocks are discarded without any error message. What happened? Well, now the javascript error causes wagtail to not include the audio block in the block count that it sends to the server when the page is saved. And the wrong block count number then causes the Wagtail edit form handler to just ignore the block completely 🙃.

TLDR: Copy&paste saved me a few minutes in the short run, but did cost me a few hours of debugging a year later.


Weeknotes 2022-11-14

, Jochen

Lots of stuff to do. Some of the projects I worked on last week:

Homepage

Since last week it's possible to deploy my homepage to staging using the new Wagtail-backed django-cast. I start to wonder how much effort it will be to migrate the content. In the old system, blog posts are just plain Django templates that are stored in the database and will be rendered upon request. This works fine but only if you fully trust the content editors, since they can inject arbitrary javascript code for example. But I want to use it to build a SaaS product and this would make it rather unpleasant I guess. In the new django-cast version I'll use the Wagtail CMS editor which should be safe to use for untrusted editors.

But now I need to convert all my template-based content to StreamField. Which seemed difficult at first, but then my lack of HTML knowledge saved the day: just throwing my old HTML content into a RichTextBlock living in a StreamField worked surprisingly well (see this: from legacy to wagtail conversion notebook). Seems like I can get away with just converting my custom template tags for images, galleries, videos and audio into proper StreamField blocks and keeping the rest of the html basically as it was. Sweet.


Django-Cast

Added a DELETE_WAGTAIL_IMAGES setting to be able to deactivate wagtail delete images physically to be able to test migrations.
This only works if cast happens to be placed behind wagtail in INSTALLED_APPS since Django has no way to call a function after all apps were installed. Video posters do now work with wagtail videos. The gallery modal now also works on the blog list page and not only on the post detail page.

django-template

Articles


Twitter

Weeknotes

Software

Books

Videos


Podcasts


Out of Context Images


Weeknotes 2022-11-07

, Jochen

Short work week. Gave me time to indulge in heavy yak shaving. At first, I tried to just make django-cast (the develop branch) work for newer Django and Wagtail versions. Then I realized I had to fix wagtail-srcset first and replaced poetry with flit while I'm at it. Then I got lost fixing some stuff in kptncook before I remembered that I have to also update django-indieweb and django-fileresponse to be able to finally fix django-cast and make it deployable on my staging system using the latest and greatest Django and Wagtail versions. Oh and then I fixed some bootstrap stuff in the commands.py of my Django startproject template. Maybe I'll manage to merge the develop branch of django-cast back into main soon after develop started to diverge back in 2019 iirc because I wanted to use Wagtail as a CMS. Looking forward to meet some hairy yaks on the way. 
 

Articles


Twitter

  • No twitter this week, just yaks
 

Weeknotes

 

Software


Podcasts

   
Out of Context Images