Bottlepy + Nginx + Uwsgi + Python3 with Virtualenv on Debian

Bottle is my favorite micro web framework for  python.  It is well designed, allows quick prototyping and also developing web based applications.

My preferred web application stack is bottle + nginx + uwsgi + firebird + debian.

So this is my brief tutorial for this stack :

Install required packages :

Prepare web files directory structure for nginx :

Let’s create our virtualenv for our applications. I prefer placing my virtaulenvs in opt directory :

Time to activate our virtualenv and install bottle :

To create our simple demo application :

And code of our simple demo application :

Let’s check if everything is working so far :

If your output is similar to below output then everything is well so far. When you locate to http://localhost:8081, your browser should say “hello” to you.

Now we can safely deactivate our virtualenv,

and start nginx configuration, first we have to create a virtual host file for nginx :

content of the nginx virtualhost is :

to activate our virtualhost we symlink it to sites-enabled directory :

Now it is time to configure our uwsgi. First we create our uswgi appliaction configuration file :

bottledemo.ini content

and symlink to enabled applications :

last touches :