Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation only shows calling from repl #443

Closed
chriscamacho opened this issue Nov 20, 2022 · 2 comments
Closed

Documentation only shows calling from repl #443

chriscamacho opened this issue Nov 20, 2022 · 2 comments

Comments

@chriscamacho
Copy link

to a new comer to WebOb, everything looks great, exactly what's needed, however as all the examples - even the write your own framework, only show examples from the repl or from the built-in web server, its not at all obvious how to use WebOb with mod_wsgi

It would be nice to show an absolute minimal mod_wsgi usable hello world "app" that shows how to integrate WebOb.

I'll bodge something via trial and error eventually I guess, but it would be nice if the docs were explicit in this case.

@chriscamacho
Copy link
Author

chriscamacho commented Nov 20, 2022

I used a decorator I found on a blog post...

def wsgiwrap(func):

    def wsgi_app(environ, start_response):
        req = Request(environ)
        try:
            resp = func(req)
        except (exc.HTTPException, e):
            resp = e
        return resp(environ, start_response)
    return wsgi_app

@wsgiwrap
def simple_app(req):
     ....
     return Response(output)

application = simple_app 

This seems to work, but no idea if this is how it's intended to be used from the current documentation...

@mmerickel
Copy link
Member

The right answer for how to do this is https://docs.pylonsproject.org/projects/webob/en/stable/api/dec.html#webob.dec.wsgify. Open to any PRs to improve the docs but I think I'm going to mark this closed for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants