[Disclaimer: This post is not constructive in any way. I'm not explaining how to to something but complaining about the process]

Deploying a Python web project.

Lets face it: It sucks. I mean, the whole thing.

Ok, I'm using PyBottle framework for being able to create a small web project in a few hours. Everything works fine in devel. I just took me 1 hour and a half for creating a URL minifier (we will talk about that in another post). And now I want to deploy it in the "right way". Hell, I've spend a few hours just sufing the internet and I don't really know how to do yet!!!

Ok, it looks like Bottle framework uses WSGIServer that is non-threading HTTP server. Nice. They recommend you to use a multi-threaded HTTP server instead and proupose some options: 16 options to be more precise. I recognise cherrypy, paste, tornado and twisted. Ok let's do it with cherrypy because they say it's multi-threaded and stable has hell. Nice. Now, how do I deploy it with Cherokee web server? Thru WSGI. Oh, crap. Cherokee does not support WSGI but uWSGI. It will be the same? I don't know. Ok, I'll just try and keep moving.

I search some examples of configuration files for the WSGI and uWSGI (an XML is required). I really find a lot of confusing information and everything for Django, Pylons or Piramid. I try to configure Cherokee and I have problem with the permissions of the files. Oooook! Let's change the owner to www-data and put 777 privileges on everything and just try if it works or not.

Doh! The VirtualEnv, I completely forget about that. In order to prevent problems between projects I'm using virtualenv. This is the Right Thing To Do(tm) but when you have to deploy the app there are just another source of problems or another layer of complexity.

So, we can repeat the steps we have to do to properly deploy a python web application:

  1. BuildApp
  2. Use Multi-Threaded HTTP Server (cherrypy)
  3. Use ~~WSGI~~ uWSGI for...
  4. ...being able to use a Web Server (cherokee)...
  5. ... that must respect your Virtualenv

F***.

I mean: Fuking cr*p. I ~~like~~ love sysadmin stuff. And I'm pretty good at it. Configuring DNS entries, installing HTTP Server with a few virtuals servers, configure mail server or even fix the washing machine. But, man! 5 steps and 4 different projects/technologies with their different documentation, for deploying a job it took me less than 2 hours it is absolutly crazy.

I have been reading a lot of criticism in HackerNews the last weeks about PHP. PHP sucks. PHP have a bad architecture. PHP is the worse programming language ever. And so on.... but I have something to say: I envy the deploy system of PHP. Single command "cp" and thats all. At most adjusting some permissions or ownerships and nothing else. It rocks!! And no all this funny-magic-super-complex thing we have to do with Python.

Bufff.... thanks mates. I feel better now. Thanks for listening me. Maybe tomorrow I'm able to explain how to avoid ~~all~~ some of this problems.