bottle:

提供app接口供uWSGI调用,例如以下例子中的application:

from bottle import Bottle, route

application = Bottle()

@application.route("/")
def index():
    return "Hello world!"

if __name__ == "__main__":
    application.run()

uWSGI:

uWSGI负责app运行,可以设置多种reload方式,方便调试,例如touch-reload.

uwsgi.ini设置实例:

[uwsgi]
daemonize = /home/goal/.log/w.log
master = true
chdir = /home/goal/1/w/diy
socket = 127.0.0.1:5000
wsgi = application:application
pidfile = /home/goal/.log/w.pid
touch-reload = /home/goal/.log/w.pid
processes = 2

Nginx:

nginx内置支持uwsgi,配合uswgi的设置:

location / {
    try_files $uri @bottle_app;
}
location @bottle_app {
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:5000;
}
comments powered by Disqus