Bottlepy, JinJa2, Paste

About a year ago, I had a client contacted me about a project that required a specific set of requirements which Django could not easily meet. I could have turned the project down, however, I liked the project too much that I could not say no. I diligently searched for alternatives to Django; alternative that were much more flexible. Many micro-frameworks started to pop into the picture. Flask was on top of my list until I learned about Bottlepy. I found myself attracted to the way Bottlepy does things: everything just made sense. I suggested it to the client and he agreed to proceed.

Learning Bottlepy took very little time. If you are new to Python or new to web development, I suggest you learn a micro-framework first and then move into a batteries included framework if you so desire. Why learning a micro-framework first? With a micro-framework you have less magic happening: a micro-framework forces you learn about how the HTTP protocol works and how python works. Many new developers give up on Django due to its lengthy documentation; Django, as well as the rest of the full feature web frameworks, has a steep learning curve.

The most amazing thing about Bottlepy is that you can easily change your ORM, template engine, server, etc.

Installing Bottlepy and paste are as easy as:

pip install bottle paste

Bottlepy already comes with a development server, you do not need to run a separate server. As a matter of fact, you rather take advantage of the new, more optimized, and edgy servers such as: paste, cherrypy, gunicorn, fapws3.

Running a Bottlepy application in production takes very little effort. Basically, you want to change the host, port, and probably server, options for your run method.

This is what a very basic hellow world applications looks like in bottlepy:

Deploying and running your Bottlepy application is easy as pie. However, you need to find a good way continue running your application after your log off of your server. In order to do this you need to run your server as a daemon. My favorite tool for this job is: upstart.