Skip to main content


Showing posts from September, 2016

Building Modular Web Apps with Blueprints

I was recently hacking about with the express framework in node.js. One thing I really like about it is that the request and response objects are passed into the callback of the route functions. Another thing which I thought was really awesome was the Router object. Specifically it allows you to isolate parts of your application which I like because it makes maintaining the application much easier. This got me thinking "I wonder if a similar concept exists within the Flask framework in Python?". 

Enter Flask Blueprints.Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. I thought as a exploratory exercise I would put together a simple application using blueprints within flask.So let's build a web application which lets you post comments and displays those comments on a web page. Okay okay, this is perfectly stupid but our purpose is to learn a little about blueprints.
A Simple ApplicationFor this application we will have a single html pag…