Deployment Bottle framework

June 19, 2014 1.6k views
alguien puede ayudar a servir una aplicación en bottle, con nginx o de cualquier manera
3 Answers
anyone can help to serve an application bottle, with nginx or otherwise
We have an article on bottle here:
by Justin Ellingwood
Python is a flexible programming language that works great for web applications. There are many frameworks available that can help you get your application running quickly. One of the most minimal of these frameworks is Bottle. In this guide, we will discuss how to install and use this framework to build Python web applications.
Building off the article that Etel linked to, a "Hello World" Bottle app might look like:
from bottle import route, run

def hello():
    return "Hello World!"

run(host='', port=3000)
You can set the port to anything you want. Now we can use Nginx as a reverse proxy. You Nginx configuration would look something like:
upstream app_server {
    server fail_timeout=0;

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 4G;

    keepalive_timeout 5;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app_server;
Note that the upstream directive is on the same port as the Bottle app. To get Nginx installed in the first place, check out:
by Justin Ellingwood
Nginx is one of the most popular web servers in the world. It is extremely flexible and powerful and can be used to efficiently host sites and applications small or large sites and applications. In this guide we'll cover how to install and set this up on an Ubuntu 14.04 server.
Have another answer? Share your knowledge.