Examples of how to add request hooks in wheezy.web
Don't know the framework, but you should probably use [middleware](https://pythonhosted.org/wheezy.http/userguide.html#middleware). Assuming `peewee_middleware` is never the last one:

```
def peewee_middleware(request, following):
    db.connect()
    try:
        response = following(request)
    finally:
        if not db.is_closed():
            db.close()
return response

app = WSGIApplication(middleware=[
    lambda x: peewee_middleware,
    path_routing_middleware_factory
])
```

I would think this question belongs more to wheezy.web project than to peewee, though.
 Thanks. I added this here because the peewee documentation specifically asks you to open a ticket if there are any other frameworks you'd like to see examples for. http://docs.peewee-orm.com/en/latest/peewee/database.html#other-frameworks
 Oh, I stand corrected. Did you have luck with the suggestion?
 @thirashima -- If you come up with some working code, please comment on this issue and I will add it to the docs. For now I am closing this.
 the code that tuukkamustonen provided does seem to be working. thank you everyone for the help.
 Cool, I will update the docs, thanks d00dz.
 http://docs.peewee-orm.com/en/latest/peewee/database.html#wheezy-web

I'd like to see an example of how to add request hooks for db connection management to the wheezy.web framework. I've tried to figure it out myself, but it is non-obvious to me. Thanks!
