I\'ve done some coding with Bottle. It\'s really simple and fits my needs. However, I got stick when I tried to wrap the application into a class :
import bo
You have to extend the Bottle class. It's instances are WSGI web applications.
from bottle import Bottle
class MyApp(Bottle):
def __init__(self, name):
super(MyApp, self).__init__()
self.name = name
self.route('/', callback=self.index)
def index(self):
return "Hello, my name is " + self.name
app = MyApp('OOBottle')
app.run(host='localhost', port=8080)
What most examples out there are doing, including the answers previously provided to this question, are all reusing the "default app", not creating their own, and not using the convenience of object orientation and inheritance.