I'm a newb to the Python world and am having the dangest time with getting sessions to work in my web frameworks. I've tried getting Beaker sessions to work with the webpy framework and the Juno framework. And in both frameworks I always get a KeyError when I try to start the session.
Here is the error message in webpy (its pretty much the exact same thing when I try to use beaker sessions in Juno too)...
ERROR
<type 'exceptions.KeyError'> at /
'beaker.session'
Python /Users/tyler/Dropbox/Code/sites/webpy1/code.py in GET, line 15
Web GET http://localhost:1234/
15. session = web.ctx.environ['beaker.session']
CODE
import web
import beaker.session
from beaker.middleware import SessionMiddleware
urls = (
'/', 'index'
)
class index:
def GET(self):
session = web.ctx.environ['beaker.session']
return "hello"
app = web.application(urls, globals())
if __name__ == "__main__": app.run()