Josh Gaunt, Ph.D.

Updating This, My Very Minimal Website

Published: Feb. 22, 2021, 5:35 p.m.

Since the previous post, I've made some updates to the site and how I work on it. I've modified the workflow a little bit but mostly just changed the tools I use throughout. I ditched the IDE I had been using, Aptana, in exchange for running Sublime Text to edit, several bash tabs via ConEmu for CLI programs, and online docs instead of context help. Although still not 100% ideal, that's how I wound up working at my last job and the transition came naturally. Moreover Aptana seemed to no longer be supported by its developers and continuing to use it seemed like an increasingly regrettable investment.

The pains of setting up and maintaining dev environments on a Windows machine with a combination of Anaconda and venv lead me to use Docker and Docker Compose to support local development. I also switched from Openshift and began deploying on Heroku instead. I've always wanted to use a standard local-stage-prod arrangement and Heroku makes that trivially easy. I can be confident no one will see any mistakes I catch deploying first to stage. I'm considering fully containerizing the site's elements (i.e. running with Docker on Heroku), mostly because it seems like I'll need to use NGINX for static files and SSL if I want better parity between my local and stage/prod environments. Funnily, I had been using Openshift for free but I decided to stop once they began charging. However I didn't realize Heroku was free only if I didn't want to use my own domain and wound up paying anyway once I had already moved my site over there.

Once I had my development and deployment environments functioning together nicely again I made a number of subtle changes. The SCSS compiler I'd been using, Compass, was no longer maintained and the Gulp plugin I was using for it was failing opaquely. After updating Gulp to v4 I switched to PostCSS plugins in Gulp to compile my CSS and finally see some small changes I made to the styling. (Ditching Compass also permitted me to remove Ruby from my system, which I had installed solely for that.) I also updated Django to v2.2 and I think if I went any further some of the middlewares I use would no longer work. Finally, I rendered the background animation to a repeatable gif so d3 wasn't hogging cpu, which let me get rid of the hilariously tacky play/pause button I had in the header for it.

Finally, a solution I found to what wasn't exactly a problem that I could find anyone else had solved before when searching. Specifically, I wanted to use template tags for things like static images in these posts. I had to find a way to transform each post from HTML strings in a database into the same form of template-based strings that I have specific pages in the site written as discrete .html files. I didn't want to write a new page and view for each post, I just wanted to be able to query from my database for everything published under /posts/. I had to pass the html through my template parser(s) after determining the context before rendering the view of each post (excerpted from views.py):

from django.template import Template, Context def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) return context def post_detail(request, uid, slug): post.main = Template(post.main).render(Context(get_context_data)) return render(request, 'post_detail.html', {'post': post})

Once again, since abandoning my old dev setup on another dead old laptop and not being able to change anything on the site in a reasonable way for a few years, I'm ready to publish new content as soon as (1) I come up with something I feel is clever enough to warrant posting and (2) have enough time to devote to doing it. 😀


blog comments powered by Disqus