This post was adapted from my Stack Overflow answer to a question about using single page applications (SPAs) with Django on Heroku.
Update: check out my django-spa package for a ready-to-use solution for serving SPAs from Django.
Here’s how to set up Django to serve your static files and index.html on / while still having the possibility to use Django views for the admin dashboard, registration etc.:
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.views import serve
from django.views.generic import RedirectView
urlpatterns = [
# / routes to index.html
# static files (*.css, *.js, *.jpg etc.) served on /
# (assuming Django uses /static/ and /media/ for static/media urls)
# other views still work too
Continue reading Simple way to set up Django and a SPA frontend on Heroku
Just as I was doing a website mockup exercise in the awesome Sketch app, I noticed that I’m missing a font locally – Open Sans, one of the many open source fonts available on Google Fonts. I went searching for some Sketch plugin to install these fonts easily (which would make sense, since they are often used on the web as they’re free and some of them are really good). I haven’t found a plug-in, but I did find a nice small Mac app that sits in your tray and allows you to easily install Google Fonts:
It’s easy to set up by installing it from the above link or using Homebrew Cask:
brew cask install skyfonts
After this, you simply browse Google Fonts on fonts.com and “add” them (you’ll need an account there).
Continue reading Easily install Google Fonts
This article on building a Raspberry Pi NAS solution has been sitting in my drafts for three years now. Recently, my Raspberry Pi had stopped working (the SD card had died), so I rebuilt it yesterday. I cursed myself for not having finishing the text back then, as I now had to retrace some steps manually. So, here goes the finished procedure for future reference.
I got a Raspberry Pi as a birthday present from my thoughtful colleagues!
Now, as my first project I decided to connect it to my 2TB external hard drive and serve it on my local network using the Samba protocol (I tried NFS and SSH too, but Samba proved to be the most performant protocol and is also cross-platform). No more moving the disk around and hooking up USB cables 🙂 Continue reading Disk on a platter
We have already talked quite a bit about the importance of self-hosting your apps due to the limitations of centralized cloud services and mentioned a number of great apps ready for self-hosting. In this blog post, we assume that you already self-host your apps to protect your data autonomy. From here, we look at what happens after you set up an app on your hardware, and how you maintain it: a job that is typically done in organisations by professional system administrators, aka sysadmins.
Source: CloudFleet – Captain’s log – The End of the Sysadmin
We are all a bit lazy in this post-holiday period, so what better project to work on during these relaxed evenings at home, but on a home automation system. Having Docker containers on a physical device that has access to all other IoT devices in our network with exposed APIs like TVs, speakers or maybe even droids and being able to iteratively upgrade these containers gives us ample opportunity to play.
I love the elegance of resin.io’s Docker container deployment & upgrade method, so I use it a lot for hobby projects & freelance work. In this tutorial, I’ll show you how to create a Python Flask app with periodic Celery tasks for controlling your TV via the Chromecast API. All of the source code can be found in this repo. So, go get a hot cup of tea, clone the repo and let’s get started…
Source: Home automation using Python, Flask & Celery