Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
/ site Public archive

{ ๐Ÿ’พ๐Ÿ’พ๐Ÿ’พ } => My personal site built with Django

License

Notifications You must be signed in to change notification settings

marcus-crane/site

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

My original personal site

This is the site that used to live at https://thingsima.de. It took on a variety of forms, using Django and Flask at various points as I experimented with different technologies.

My current site lives here but some ofthe code I used for this site I still find useful so it lives on in archival.

The README below may not longer be accurate but if you dig through the commit history, you can find the results of my efforts like having a stats site that was dynamically updated by a Celery worker in the background every 5 - 10 minutes.

Nowdays, I'm more interested in something with a lower maintenance burden so I'm striving to accomplish the same with a static site. Likely I'll end up with what amounts to a microservice pulling dynamic data that's queried using the fetch Web API. The rest would just be static


Overview

My site is always a work in progress but currently it consists of 3 pages: Home, Blog and Stats. While the first is nothing more than a placeholder, the other two have a little bit more going on under the hood.

Blog

The blog section of my site isn't too different from traditional Django blogs. It defines a generic Post model and uses the default Django admin because it works perfectly fine. Where it starts to divert a little is through it's use of Markdown. I specifically use mistune which claims to be the fastest Python markdown parser, not that I'm worried about speed in this case.

On a side note, mistune is not what I'd consider beginner friendly if you're new to Python. It's fine for basic Markdown but if you want to extend it to support ie blockquotes, code blocks and what not, it's not super straight forward I found. I had to learn a bit to wrap my head around it but now this project serves as an example of it running in the wild which is neat. My custom parser for blockquotes is pretty rubbish but it does the job.

Stats

The stats section is easily my favourite and is where the bulk of work has gone. You can see it here where it shows recent media that I've been consuming. It's not static, it actually pulls directly from various APIs and automatically updates every so often! There's even a hidden endpoint for triggering a manual update so I can say "Alexa, trigger manual site refresh" and it'll refresh my stats. It started as a dumb idea and just kinda kept growing over time. I don't know if I consider it a "good" idea but it's something I thought of as a kid and now I've finally learnt enough to make it come true.

In order to update stats on a cycle, I use a Celery worker that queues updates using RabbitMQ. Honestly, it's a glorified cron scheduler and I'm thinking about converting them to AWS Lambdas that get triggered by Cloudwatch. I struggled to find examples of projects that used Django AND Celery AND RabbitMQ, let alone included a Docker Compose setup so enjoy.

Local Development

If you attempt to develop locally, you'll be bugged for a keys.ini file which lives in site/thingsimade. You can see an example template inside site/thingsimade/ex_keys.ini. They're not all needed or even used, I just haven't cleaned up the file is all. You can just fill them with garbage (or rename ex_keys.ini to keys.ini) and ignore any errors that pop up. They're only used by Celery anyway so it should be fine. You'll just have an empty database when you try to render the stats page is all.

The quickest way to get set up is using Docker. If you've got it installed, running make dev should get you setup.

Deployment

I don't know why you'd want to deploy my site because, well, it's mine but I just deploy it as a background Docker process and then point it to an nginx config on a Vultr VPS.

As mentioned before, I'm looking at breaking this setup into smaller bits and deploying it on AWS for fun and learning. If I do get around to that, I'll likely archive this repository for historical/reference purposes.

Thanks for reading!

Releases

No releases published

Packages

No packages published

Languages