Mercurial > public > src > rhodecode
diff pylons_app/config/middleware.py @ 12:5f30a6d558dc
Added pylons manage script
fix the configs for zip archives
some other minot changes.
author | Marcin Kuzminski |
---|---|
date | Sat, 20 Feb 2010 17:51:51 +0100 |
parents | 525ed90e4577 |
children | 923f0e6ab010 |
line wrap: on
line diff
--- a/pylons_app/config/middleware.py Sat Feb 20 14:37:29 2010 +0100 +++ b/pylons_app/config/middleware.py Sat Feb 20 17:51:51 2010 +0100 @@ -8,10 +8,11 @@ from pylons.middleware import ErrorHandler, StatusCodeRedirect from pylons.wsgiapp import PylonsApp from routes.middleware import RoutesMiddleware - from pylons_app.config.environment import load_environment -def make_app(global_conf, full_stack = True, static_files = True, **app_conf): + + +def make_app(global_conf, full_stack = True, **app_conf): """Create a Pylons WSGI application and return it ``global_conf`` @@ -19,14 +20,10 @@ the [DEFAULT] section of the Paste ini file. ``full_stack`` - Whether this application provides a full WSGI stack (by default, - meaning it handles its own exceptions and errors). Disable - full_stack when this application is "managed" by another WSGI - middleware. - - ``static_files`` - Whether this application serves its own static files; disable - when another web server is responsible for serving them. + Whether or not this application provides a full WSGI stack (by + default, meaning it handles its own exceptions and errors). + Disable full_stack when this application is "managed" by + another WSGI middleware. ``app_conf`` The application's local configuration. Normally specified in @@ -40,12 +37,10 @@ # The Pylons WSGI app app = PylonsApp() + # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) + # Routing/Session/Cache Middleware app = RoutesMiddleware(app, config['routes.map']) - app = SessionMiddleware(app, config) - app = CacheMiddleware(app, config) - - # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) if asbool(full_stack): # Handle Python exceptions @@ -61,14 +56,9 @@ # Establish the Registry for this application app = RegistryManager(app) - if asbool(static_files): - # Serve static files - static_app = StaticURLParser(config['pylons.paths']['static_files']) - app = Cascade([static_app, app]) + # Static files (If running in production, and Apache or another web + # server is handling this static content, remove the following 3 lines) + static_app = StaticURLParser(config['pylons.paths']['static_files']) + app = Cascade([static_app, app]) + return app - #dozer debug - if asbool(config['debug']): - from dozer import Logview - app = Logview(app, config) - - return app