Páginas

domingo, 8 de fevereiro de 2015

Falcon, Django, PyPy & Docker

Late last year I learned about the Falcon Framework, one more to the list of many Python frameworks out there. Falcon focus on performance, having quite impressive benchmarks.



So I was wondering how can you have super fast API endpoints in your Python web service while still serving some legacy code in Django, or just any other WSGI-compliant framework.

The outcome of my experiment lives in this GitHub repo: rhcarvalho/django-plus-falcon-pypy.

I'm using Gunicorn with Tornado workers to serve this glue-code WSGI app:


And the nicest part is how you can run this hybrid application: fig up

Fig will build a Docker image, pack it with all the necessary dependencies to run our example web server, then run it in a Docker container.

Behind the scenes you get a fresh operating system with PyPy installed, all Python dependencies and the application code.

Fig is a tool on top of Docker, and Docker...

If you haven't done it yet, try Docker now! You can get started straight from your browser, no download required, and you'll experience a very immersive tutorial that guides you through the initial steps with Docker.

Then I advise you to go trough the official documentation because it is great. You might want to start by understanding what Docker is, install it, create an account on Docker Hub and then follow along the excellent user guide.

The installation on Linux, Mac OS or Windows is generally painless. You can even have it inside some virtual machine.

Nenhum comentário: