Coder Social home page Coder Social logo

marcus-crane / site Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 5.14 MB

{ πŸ’ΎπŸ’ΎπŸ’Ύ } => My personal site built with Django

Home Page: http://thingsima.de

License: MIT License

Python 81.21% CSS 0.54% HTML 16.95% Shell 0.78% Makefile 0.28% Dockerfile 0.24%
site fun python celery rabbitmq docker django postgresql psycopg2 python3

site's Introduction

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!

site's People

Contributors

marcus-crane avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

site's Issues

Comb through settings

The settings file may or may not come with a bunch of settings I don't actually need.

It's worth going through it.

Write a README

There's no README for anyone who might want to run the site locally, even though they can just visit https://thingsima.de.

Development is far along enough that I can write one

Prev and Next buttons

The previous and next buttons order posts by ID, rather than date.

This would be easier when I finally hook up the publish method to the admin console seeing as there's nothing requiring published posts to have dates I believe?

Client Side Validation

The form just recently put into the site doesn't perform client side validation.

I'll need to add popup messages anyway, I just haven't gotten that far along yet.

Recaptcha verification

Submitting the contact form should verify that the recaptcha was successful with Google.

Style admin panel

Seeing as the admin panel theme only applies while Django is in debug mode, I can't actually set the date or time without a date picker!

Deployment guide

I just know I'm gonna forget how to deploy this thing so it would be useful to write a little guide on how to do that.

I should also include the actual systemd files I use in conjunction with Gunicorn.

Perhaps it'd merit a blog post even?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.