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

Ubuntu creative suite

Doing some web design these days, I find that Ubuntu offers a really mature stack to tackle the job with powerful applications and good OS integration. Drag’n’drop a wide spectrum of objects between applications to avoid having to browse through your files, multiple desktops to reduce window chaos and the do-one-thing-but-do-it-right philosophy stemming from the terminal era and general speed are some of the advantages that you notice quite quickly as really helpful. I’ll shortly cover some of the apps I use and their best features.

For the initial concept forming I use:

  • Shotwell – great for importing & organizing “inspiration” photographs; tags and grades really help a lot and it’s cool to be able to quickly colour-balance, straighten and crop photos
  • Nautilus – with its multiple tabs, split windows and drag’n’dropability of files, folders, & bread crumbs, it is an essential helper throughout the whole process (the dash is also a good sidekick with quick search capabilities for far-away files and apps)
  • Gpick – creating colour systems by picking colours from photographs, pdfs, extending them through colour harmony rules, ctrl+c-ing hex values to your clippboard or dragging colours or importing full profiles to Inkscape or GIMP… a tad unstable, but powerful as hell!

Continue reading Ubuntu creative suite