Re: [pylons-discuss] Stupid noob question on Pyramid running under IIS.

2014-10-14 Thread joe
Thanks Michael!  I really appreciate it.  I was able to get the sample 
working with your help.


-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Stupid noob question on Pyramid running under IIS.

2014-10-13 Thread Michael Merickel
The app in your second example has the same signature as
application in your first example. They are both objects that
conform to the WSGI protocol.

So if your runner for IIS is looking for an application module-level
variable to be defined in that module then hopefully you have your
answer that you just rename app to application and probably get
rid of the if __name__ part, as well as the server.

An example of the file you are attempting to create can be found in
pyramid's mod_wsgi documentation [1]. Pasted below for clarity would
be a file named wsgi.py that is the entry-point (replacing your
first sample application). Your actual code would be unchanged from
any of the tutorials, meaning it would go in another module and then
instead of using pserve production.ini you are passing
/path/to/wsgi.py to your IIS configuration.

from pyramid.paster import get_app, setup_logging
ini_path = '/Users/chrism/modwsgi/env/myapp/production.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

[1] 
http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/tutorials/modwsgi/index.html


On Mon, Oct 13, 2014 at 2:46 PM,  j...@goldthwaites.com wrote:
 This is embarassing but I've been unable to figure out what's going on.  I'm
 trying to write a WSGI application that will be running under IIS. As I
 understand it, WSGI is a pretty simple API. I have a sample application
 running;


 def application(environ, start_response):
 WSGI Application

 start_response('200 OK', [('Content-type','text/html')])
 return ['Hello World!']

 This is a very basic WSGI application. IIS passes the environment and
 start_response objects and I return an iterable.  This doesn't help in
 mapping URLs to functions and so forth so I started looking around for a
 good framework to manage that stuff. I'd heard good things about Pyramid so
 I thought I'd give that a try.  When I searched for a WSGI example, I found
 this;

 from wsgiref.simple_server import make_server
 from pyramid.config import Configurator
 from pyramid.response import Response

 def hello_world(request):
 return Response('Hello %(name)s!' % request.matchdict)

 if __name__ == '__main__':

 config = Configurator()
 config.add_route('hello', '/hello/{name}')

 config.add_view(hello_world, route_name='hello')

app = config.make_wsgi_app()
 server = make_server('0.0.0.0', 8080, app)
 server.serve_forever()

 This example looks like it's using WSGI since it's calling the
 make_wsgi_app() method of the config object but I'm not seeing anything that
 I can expose to IIS, i.e. any function with (environ, start_response) as the
 parameters. I'm sure it's burried somewhere in app but I haven't been able
 to find any examples of how to do it.

 Can anyone point me to a simple example using pyramid under IIS?

 Thanks

 --
 You received this message because you are subscribed to the Google Groups
 pylons-discuss group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to pylons-discuss+unsubscr...@googlegroups.com.
 To post to this group, send email to pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.