preloader

Falcon Cookiecutter - Pozetron Inc

When you are searching for the perfect technology stack for your API or Microservice you may come to the realization, as did we, that there is no such thing. Rather than let this get you down, just go with the flow and pick one that’s terrific out of the box.

As a company, we write a lot of Python, whether that’s MicroPython on embedded devices or CPython on the server side. It’s probably no surprise then that our architecture is made up of lots of different Python services on the backend. To facilitate this, we’ve been using a Cookiecutter template for a while now that gives a nice balance of speed in development as well as speed in production. You can see the output of this template in our barcode service which powers https://qrbarco.de/

There are several nice features of this template that make development faster.

The first is the way that it handles Settings with an easy to use pattern like from settings import REDIS_HOST, REDIS_PORT, REDIS_DB). The second really nice feature of this template is the docker-compose file which makes local development with a database or cache really easy.

When it comes to production speed, this stack has you covered there as well. Bjoern describes itself as “the fastest, smallest and most lightweight WSGI server out there”.

When it comes to Python almost all of your CPU time will be spent in your Python program but it’s nice to know that your WSGI server is fast too:

Again, most of what is going to keep your CPU busy is not going to be your framework’s code but rather your application’s code which you’ll be responsible for. However having a framework that’s very very fast doesn’t hurt. Falcon also encourages good abstractions and code reuse that should help to keep you on track with writing your own code to be as lean and mean as possible.

So after a few years of using this combination in production, why did we decide to write a blog about it now? Well first of all, this combination has been working well for us for a few years! Also, the key components of this stack have seen major version bumps recently with Falcon going to 2.0 and Bjoern entering the 3.x series. Along the way, we’ve been using the excellent 7ideas cookiecutter and modifying the dependencies as we go. In celebration of these milestones however we thought we would release our own very modest contributions over at https://github.com/pozetroninc/cookiecutter-falcon2 with these version bumps already applied so that you can enjoy them too!

Free Registration

No credit card required. Limited time only.

Register Free