Mercurial > piecrust2
annotate piecrust/wsgiutil/cwdadminapp.py @ 1145:e94737572542
serve: Fix an issue where false positive matches were rendered as the requested page.
Now we try to render the page, but also try to detect for the most common "empty" pages.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 05 Jun 2018 22:08:51 -0700 |
parents | b4156f5d4368 |
children |
rev | line source |
---|---|
897
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 # This is a utility module that can be used with any WSGI-compatible server |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 # like Werkzeug or Gunicorn. It returns a WSGI app for serving a PieCrust |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 # administration panel located in the current working directory. |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 import os |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 from piecrust.wsgiutil import get_admin_app |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 root_dir = os.getcwd() |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 app = get_admin_app(root_dir) |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 # Add this for `mod_wsgi`. |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 application = app |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 |
b4156f5d4368
wsgi: Add admin panel to WSGI helpers.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 |