comparison piecrust/wsgiutil/cwdapp.py @ 379:d40b744a9d99

serve: Add a generic WSGI app factory.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 09 May 2015 08:48:58 -0700
parents fe8a58817088
children
comparison
equal deleted inserted replaced
378:fe8a58817088 379:d40b744a9d99
1 # This is a utility module that can be used with any WSGI-compatible server 1 # This is a utility module that can be used with any WSGI-compatible server
2 # like Werkzeug or Gunicorn. It returns a WSGI app for serving a PieCrust 2 # like Werkzeug or Gunicorn. It returns a WSGI app for serving a PieCrust
3 # website located in the current working directory. 3 # website located in the current working directory.
4 import os 4 import os
5 from piecrust.serving.server import Server 5 from piecrust.wsgiutil import get_app
6 6
7 7
8 root_dir = os.getcwd() 8 root_dir = os.getcwd()
9 server = Server(root_dir, sub_cache_dir='prod', enable_debug_info=False) 9 app = get_app(root_dir)
10 app = server.getWsgiApp()
11 # Add this for `mod_wsgi`. 10 # Add this for `mod_wsgi`.
12 application = app 11 application = app
13 12