New Photolog

Published: 2019-10-05
Tagged: django news

Back in 2014, I was curious about Clojure and decided to cook up a simple web app to display all the cool photos my wife and I take. It worked ok, but as time went by, my knowledge of Clojure melted away and my regrets about a few design choices grew. Why did it need a full client-server database like postgresql? Why did it need to be dependent on some very specific version of java? Why was it written in a language I could no longer comfortably write? Why was it locking up after some fairly high number of requests, so that I had to restart the process via a cronjob?

Last September, I finally got around to addressing all of those problems. Here's the result: http://photolog.mattscodecave.com/

Yes, it looks and feels exactly the same. However, all the insides are changed.

The site is written in Python 3 and Django. It'll be easy to modify and update for the years to come on account of how mature Django is and how much experience I have with Python. It was fun to play around with Django, something I haven't used in the past 3 years, but remember enough of to have made this project a breeze. Instead of postgresql, the state is kept in a single sqlite3 database, which means one less process to manage, one less component to update, and easy as pie database back ups. I didn't bother to set up gulpjs or anything front-end related and just copied over the minified js and css. It saved me some time and I think any front-end changes to come will start from a clean slate. Finally, deployment is arranged through docker and systemd. The Django application is served through gunicorn and lives inside of a docker container. This makes handling dependencies like Django and imagemagick easy. When I need to deploy an update, I build the image locally and push it to my server alongside any static files. A systemd unit file takes care of restarting the process and making sure it starts across system reboots. I already have an nginx server running, so I only had to point it at the new upstream.

Simple and good enough. It feels like laying down in a freshly made bed.

Back to Top
Back to Blog

Hi, I'm Matt.

Notes on programming and life. Often both.

All views expressed are my own.