middleware.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: utf-8 -*-
  2. """WSGI middleware initialization for the pod application."""
  3. from pod.config.app_cfg import base_config
  4. from pod.config.environment import load_environment
  5. __all__ = ['make_app']
  6. # Use base_config to setup the necessary PasteDeploy application factory.
  7. # make_base_app will wrap the TG2 app with all the middleware it needs.
  8. make_base_app = base_config.setup_tg_wsgi_app(load_environment)
  9. def make_app(global_conf, full_stack=True, **app_conf):
  10. """
  11. Set pod up with the settings found in the PasteDeploy configuration
  12. file used.
  13. :param global_conf: The global settings for pod (those
  14. defined under the ``[DEFAULT]`` section).
  15. :type global_conf: dict
  16. :param full_stack: Should the whole TG2 stack be set up?
  17. :type full_stack: str or bool
  18. :return: The pod application with all the relevant middleware
  19. loaded.
  20. This is the PasteDeploy factory for the pod application.
  21. ``app_conf`` contains all the application-specific settings (those defined
  22. under ``[app:main]``.
  23. """
  24. app = make_base_app(global_conf, full_stack=True, **app_conf)
  25. # Wrap your base TurboGears 2 application with custom middleware here
  26. return app