> app – an instance of Bottle or a WSGI application.
So, that means a require to load the code, and the some kind of app = my app.default_app()?
Do you have an example of how you create an instance of a wsgi app? For bottle it looks like that's normally something bottle.run() does?
But looking at the quickstart, you typically don't subclass Bottle, you require it, and call run()? So your typical bottle app won't be a subclass of bottle? At which point you can't make an instance of it, to pass to mount()?
Looking at the documentation for mount() it looks like you should be able to mount the quick-start app - but it's not clear of you create an instance to pass to mount?
That is if I have example.py:
from bottle import route, run, template
@route('/hello/<name>')
def index(name):
return template('<b>Hello {{name}}</b>!', name=name)
run(host='localhost', port=8080)
How do I write example_mount.py that mounts example.py under /hello1 and /hello2? test.py
=======
import bottle
@bottle.get('/')
def index():
return 'INDEX'
# a new wsgi app
hello = bottle.Bottle()
@hello.get('/<name>')
def greet(name):
return 'Hello, ' + name
bottle.app().mount('/hello', hello)
Test like this: python3 -m bottle --bind :8080 testYou should have 2 working routes, "/" and "/hello/<name>".
[1] https://bottlepy.org/docs/dev/api.html#bottle.Bottle.mount