Bottle: Python Web Framework — Bottle 0.13-dev documentation
Since there was a good sample source elsewhere, Introduction to Python3 Bottle Framework (Part 1) -Basic Server Start Let's use it.
from bottle import route, run, template
@route('/hello/<name>')
def index(name):
return template('<b>Hello {{name}}</b>!', name=name)
run(host='0.0.0.0', port=8080)
Just by looking at 7 lines of this sample source, it's a level that says "yes".
However, the writing style of flask is very similar, so what's the difference? You might think. Eun, the implementation style is almost the same as flask: P
In fact, it can be implemented at the same time. (Seriously)
speed difference between wsgi, Bottle, Flask -Qiita
import flask
import bottle
app = flask.Flask(__name__)
bottle_app = bottle.app()
@bottle_app.route('/')
@app.route('/')
def index():
return b"Hello, World"
def wsgi(env, start):
c = b"Hello, World"
start("200 OK", [('Content-Type', 'text/plain'), ('Content-Length', str(len(c)))])
return [c]
#starting method
# Flask: gunicorn -k meinheld.gmeinheld.MeinheldWorker -b :6000 app:app
# Bottle: gunicorn -k meinheld.gmeinheld.MeinheldWorker -b :6000 app:bottle_app
# wsgi: gunicorn -k meinheld.gmeinheld.MeinheldWorker -b :6000 app:wsgi
According to the link above, bottles are about twice as fast as flasks. Another advantage is the ease of handling due to the small number of files.
bottlepy/bottle: bottle.py is a fast and simple micro-framework for python web-applications.
You see, there are no directories like lib or src in the repository. No, I'm not saying that there are many flask files. But if it's an implementation that only requires bottles, it's easier to set up a server using bottles.
For example, you can commit and deploy with the development source.
Well, it ’s the wisdom of life.
There are comparative articles here and there, so if you are interested, you should read them. It's English.