Thursday, 25 February 2016

Python: Productionizing A Flask Application

Productionizing A Flask Application:

When I released bull as an open source project, it was in quite a state. Everything was in a single file, there was inline HTML (ew), and both tests and documentation were non-existent. Over the past week, I've spent some time "productionizing" bull, and recounting the steps I took will likely be helpful to others looking to deploy a Flask app to production. In this article, you'll learn how to organize a Flask application, add testing and documentation, and even how to enable authentication for "admin-only" content.

bull looks like a pile of...

The first git push of bull was a crazy mess, but it worked, and that's all I was concerned with at the time. I knew I would clean everything up "later", so I wasn't worried about the quality at that time. Besides, anyone capable of using bull in that state was certainly capable of cleaning it up a bit on their own, if they so desired.
To make it more accessible, however, it needed an overhaul. By focusing on a few key areas, I was able to makebull a solid, production-ready application. Those areas included:
  1. Project layout
  2. An "admin" work flow with restricted pages
  3. Automated testing
  4. Automated documentation generation
I'll discuss each of these sections in detail, as I'm convinced that, if you get these areas right, you're 90% of the way to having a production-ready application.




No comments:

Post a Comment