Question

Deployment Bottle framework

  • Posted June 19, 2014

alguien puede ayudar a servir una aplicación en bottle, con nginx o de cualquier manera

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Building off the article that Etel linked to, a “Hello World” Bottle app might look like: <pre> from bottle import route, run

@route(‘/hello’) def hello(): return “Hello World!”

run(host=‘0.0.0.0’, port=3000) </pre> 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: <pre> upstream app_server { server 127.0.0.1:3000 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;
server_name your-domain.com;

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;
}

} </pre> Note that the upstream directive is on the same port as the Bottle app.

To get Nginx installed in the first place, check out:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-14-04-lts

anyone can help to serve an application bottle, with nginx or otherwise