Ah, I think I got it.
application() needs to be:
def application(environ, start_response):
> """
> Main application executable that mod_wsgi will execute when accessing
> the root of the server. This will create a new instance of our App.
> """
> app = App()
>
> app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
> '/js': os.path.join(web_path, 'js')
> })
>
> return app.wsgi_app(environ, start_response)
>
On Wednesday, 17 April 2013 11:18:04 UTC-7, Evgueni Naverniouk wrote:
>
> Having some trouble getting SharedDataMiddleware to work in my app using
> mod_wsgi.
>
> Here's my "app.wsgi" file:
>
> from werkzeug.wrappers import Request, Response
>> from werkzeug.wsgi import SharedDataMiddleware
>>
>> web_path = "some_path/here"
>>
>> class App(object):
>> """
>> This is the main class that will load the Cumul8 Dashboard
>> application. It gets instantiated by mod_wsgi via the
>> """
>> def __init__(self):
>> template_path = '/test'
>>
>>
>> def wsgi_app(self, environ, start_response):
>> """
>> Instantiate the mod_wsgi application
>> """
>>
>> request = Request(environ)
>> html = "test"
>>
>> # Return response
>> response = Response(html, mimetype='text/html')
>>
>> # Create a new wsgi app instance
>> return response(environ, start_response)
>>
>>
>> def application(environ, start_response):
>> """
>> Main application executable that mod_wsgi will execute when accessing
>> the root of the server. This will create a new instance of our App.
>> """
>> app = App().wsgi_app(environ, start_response)
>>
>> # HELP HERE
>> # If I remove this line -- everything work fine.
>> app = SharedDataMiddleware(app, {
>> '/js': os.path.join(web_path, 'js'),
>> '/css': os.path.join(web_path, 'css')
>> })
>>
>> return app
>>
>
>
> Note the Help comment in the application function. As soon as I add that
> line I get the fellow error in the error log:
>
> TypeError: 'SharedDataMiddleware' object is not iterable
>
> The Werkzeug examples seem to be using the default web server call and the
> syntax is different. How do I get it to work using the code above?
>
> Thanks for your help.
>
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.