Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
config.add_wsgi_app?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Kerrin  
View profile  
 More options Dec 5 2011, 7:57 am
From: Michael Kerrin <michael.ker...@gmail.com>
Date: Mon, 5 Dec 2011 12:57:53 +0000
Local: Mon, Dec 5 2011 7:57 am
Subject: config.add_wsgi_app?

Hi,

I am starting to use Pyramid for a project and I want to integrate some
third party code of mine that has already been developed and provides a
WSGI application already.

Ideally I want some code in my entry point to my Pyramid app that does the
following::

def main(global_config, **settings):
    config = Configurator(...)
    ...
    mywsgiapp = WSGIApp(app_config_settings)
    config.add_wsgi_app(mywsgiapp, name = "application_namespace")
    ...

My rational for this is that my application shares a lot of configuration
that is already defined for Pyramid that I can reuse. But I also want to
support other web frameworks, but with an minimal amount of dependencies
and options on my third party code.

Pyramid views and WSGI applications implement two different apis, which is
fine but I would like to think (or explore the idea) that the WSGI
interface can be used as a gateway between frameworks as well as from
framework <-> server.

So my question is has anyone looked into doing this?

Thanks,
Michael

--
Blog: http://mkerrin.wordpress.com/
Twitter: http://twitter.com/michael_kerrin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile   Translate to Translated (View Original)
 More options Dec 5 2011, 11:30 am
From: Michael Merickel <mmeri...@gmail.com>
Date: Mon, 5 Dec 2011 10:30:08 -0600
Local: Mon, Dec 5 2011 11:30 am
Subject: Re: config.add_wsgi_app?

Does this help? Basically you can add a view that is actually a wsgi
application.

http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/api/wsgi...

On Mon, Dec 5, 2011 at 6:57 AM, Michael Kerrin <michael.ker...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Kerrin  
View profile  
 More options Dec 5 2011, 12:06 pm
From: Michael Kerrin <michael.ker...@gmail.com>
Date: Mon, 5 Dec 2011 17:06:45 +0000
Local: Mon, Dec 5 2011 12:06 pm
Subject: Re: config.add_wsgi_app?

Yipe, thanks for that. pyramid.wsgi.wsgiapp2 works with a small tweak as it
doesn't support handling an object instance.

I know that it is meant to be a decorator on a method but I don't want my
third party WSGI code to depend on pyramid so I am now trying to do the
following:

wsgiapp =  WSGIApp(app_config_settings)
config.add_view(pyramid.wsgi.wsgiapp2(wsgiapp), name = 'jinja2js')

I get an attribute error, when the decorate tries to wrap the __name__
attribute from my app. Which doesn't have a __name__ as it is an instance
of a class. I will add an issue for this.

Thanks for the hint,
Michael

On 5 December 2011 16:30, Michael Merickel <mmeri...@gmail.com> wrote:

--
Blog: http://mkerrin.wordpress.com/
Twitter: http://twitter.com/michael_kerrin

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Dec 5 2011, 1:36 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Mon, 5 Dec 2011 12:36:15 -0600
Local: Mon, Dec 5 2011 1:36 pm
Subject: Re: config.add_wsgi_app?

As a quick fix you can just wrap your object in a function.

def my_wsgi_app(environ, start_response):
    return MyWsgiObj(environ, start_response)

config.add_view(wsgiapp2(my_wsgi_app), name='jinja2js')

On Mon, Dec 5, 2011 at 11:06 AM, Michael Kerrin <michael.ker...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »