How do you use bottle subapps with beaker Sessions?
bottlepy.org shows examples for both:
Sub-apps http://bottlepy.org/docs/dev/tutorial.html#plugins-and-sub-applications
Sessions http://bottlepy.org/docs/dev/recipes.html#keeping-track-of-sessions
Combined
from bottle import Bottle
from beaker.middleware import SessionMiddleware
session_opts = {
'session.type': 'file',
'session.cookie_expires': 300,
'session.data_dir': './data',
'session.auto': True
}
app = Bottle()
app = SessionMiddleware(app, session_opts)
@app.route('/')
def hello():
return 'Hello World'
app.run()
This kicks out the following error:
Traceback (most recent call last):
File "example.py", line 14, in <module>
@app.route('/')
AttributeError: 'SessionMiddleware' object has no attribute 'route'
The answer was provided here: https://github.com/bbangert/beaker/issues/79#issuecomment-89769806