annotate piecrust/wsgiutil/cwdapp.py @ 378:fe8a58817088

serve: Compatibility with `mod_wsgi`.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 09 May 2015 08:37:32 -0700
parents 21687b933193
children d40b744a9d99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 # This is a utility module that can be used with any WSGI-compatible server
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2 # like Werkzeug or Gunicorn. It returns a WSGI app for serving a PieCrust
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 # website located in the current working directory.
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4 import os
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 from piecrust.serving.server import Server
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 root_dir = os.getcwd()
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9 server = Server(root_dir, sub_cache_dir='prod', enable_debug_info=False)
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 app = server.getWsgiApp()
378
fe8a58817088 serve: Compatibility with `mod_wsgi`.
Ludovic Chabant <ludovic@chabant.com>
parents: 376
diff changeset
11 # Add this for `mod_wsgi`.
fe8a58817088 serve: Compatibility with `mod_wsgi`.
Ludovic Chabant <ludovic@chabant.com>
parents: 376
diff changeset
12 application = app
376
21687b933193 serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
13