Deploy a Django REST API to Heroku in 5 minutes

Sometimes you’re super eager to get started with a new project! Seems easy – you set up a git repo, use django-admin startproject to generate an empty project, start adding dependencies… You want to use Django REST framework for the API, so you install that. Then you need to connect Postgres for the database… Oh, but you want to deploy to Heroku, so you need to configure that DATABASE_URL environment variable and hook that up in – there was that one project where we had that working already, we can copy/paste it for sure… Celery for async tasks… Redis… 😴… Wait, what were we building again?

If the scenario described above sounds familiar, then like me you’ve run into the problem of boring, repetitive and uncreative work necessary to set up a modern web app project. A lot of boilerplate is needed to get a basic project working and best practices keep changing. Sure, there are solutions like cookiecutter-django which is quite nice, but with ~40 requirements spread across 3 files and ~500 lines of settings spread across 4 files it might be overkill when you’re just getting started. More importantly, while cookiecutter is great for initial project generation, it doesn’t allow you to easily update a project afterwards. Regenerating the project, even when exactly the same prompt answers are selected results in “Error: “my_awesome_project” directory already exists”. As already stated, best practices change over time and it would be useful to have an easy way to update your project boilerplate occasionally.

To address these issues, I’ve developed generator-django-rest – a Yeoman generator for quickly bootstrapping a (relatively simple) Django REST API project that’s deployable to Heroku in 5 minutes. In this post we’ll explain how it works (and why use a JavaScript framework for generating Pythong code 😱), but first let’s see it in action in this screencast:

Continue reading Deploy a Django REST API to Heroku in 5 minutes

A no fuss Docker install on Rapberry Pi 2

During CloudFleet development, we had some problems in finding a consistent way to install Docker in Debian Jessie on ARM (Raspberry Pi 2). Debian moved us around between mirrors a bit and then eventually settled on Docker 1.7.1 which doesn’t work on ARM (Socket operation on non-socket). Luckily, we found a nice Docker .deb package that works on ARM thanks to the Hypriot community (check the link for the latest Docker version). To use it, simply do:

dpkg -i docker-hypriot_1.8.2-1_armhf.deb

Or if you use Ansible, use this snippet: Continue reading A no fuss Docker install on Rapberry Pi 2

A talking Raspberry Pi using

Just trying out which is a nice new service that enables you to deploy apps to Raspberry Pi devices in a Heroku-like workflow:

git push resin master

In this post I’ll explain how I deployed a simple app that recites “N green bottles” written in Node.js to my Raspberry Pi via – without having to ssh to the Pi even once. Continue reading A talking Raspberry Pi using