Mercurial > piecrust2
annotate piecrust/wsgiutil/cwdapp.py @ 376:21687b933193
serve: Add a WSGI utility module for easily getting a default app.
This makes it easy to run Gunicorn from the command-line using the Gunicorn
script instead of the `chef serve` command.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 07 May 2015 22:47:44 -0700 |
parents | |
children | fe8a58817088 |
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() |
21687b933193
serve: Add a WSGI utility module for easily getting a default app.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 |