diff options
author | blackbird <blackbird@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-22 10:20:26 +0000 |
---|---|---|
committer | blackbird <blackbird@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-22 10:20:26 +0000 |
commit | a566bb8f36bd66041b4ad2013c1bf1b1ab671600 (patch) | |
tree | d8514028f29e0190cbf40b0f0ac4507d0e787571 /sandbox/py-rest-doc/sphinx-web.py | |
parent | 40324a6a49bc5a241f8139f94203e820bf90e6f2 (diff) | |
download | docutils-a566bb8f36bd66041b4ad2013c1bf1b1ab671600.tar.gz |
added basic WSGI application for the documentation (and ported too many werkzeug features over, after the app is finished we should remove the unused)
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5079 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/py-rest-doc/sphinx-web.py')
-rw-r--r-- | sandbox/py-rest-doc/sphinx-web.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sandbox/py-rest-doc/sphinx-web.py b/sandbox/py-rest-doc/sphinx-web.py new file mode 100644 index 000000000..e7c660da1 --- /dev/null +++ b/sandbox/py-rest-doc/sphinx-web.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +""" + Sphinx - Python documentation webserver + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: 2007 by Armin Ronacher. + :license: Python license. +""" +import sys +from wsgiref.simple_server import make_server +from sphinx.web.application import make_app + +if __name__ == '__main__': + if len(sys.argv) != 2: + print 'usage: %s <doc_root>' % sys.argv[0] + sys.exit(-1) + app = make_app({'data_root_path': sys.argv[1]}) + + #XXX: make this configurable + try: + from werkzeug.debug import DebuggedApplication + except ImportError: + pass + else: + app = DebuggedApplication(app, True) + + srv = make_server('localhost', 3000, app) + try: + print 'Running on http://%s:%d/' % srv.socket.getsockname() + srv.serve_forever() + except KeyboardInterrupt: + pass |