reStructuredText basic server in Python
what is it
A very simple server which transforms ReST (reStructuredText) files to HTML on the fly. Errors during transformation will be sent to the browser too, so it is IMHO a quite useful development tool for ReST files. A "site" being build this way may also be published as static HTML with a simple converter script.
Inital version inspired by the
Twisted reStructuredText Server
from the ActiveState Cookbook site but working on a basic Python installation using the included
. You may want to look there for improvements like caching though.
The generated XHTML files should ideally be sent with mime-type
application/xhtml+xmlbut as Docutils currently adds
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />the Content-Type header
text/htmlis currently sent by the server too.
This module has been placed in the public domain. (New license from v2.0)
- restserver-2.0.zip 070911
- ( restserver.py v1.3 060111 - replace .txt with .py extension (very simple script version))
See the provided example and docutils.conf which should be pretty self explanatory.
- v2.0 070911
- extended docutils configuration file
- added converter to static HTML
- added HEAD in addition to GET method (e.g. if you like to access a file from the server and first want to check if it is present at all)
- needs docutils 0.5 to be able to use a template
- new licence
- v1.3 060111
- added txt2html.xsl which converts *.txt links to *.html
if no path (or "
/") is given, "index." +
RST_EXTis tried to prevent a maybe older index.html to be shown by default behaviour of
- v1.2 050604
- supports command line options same as those for rst2html.py with a patch from Felix Wiemann
RSTEXTto configure extension for ReST files the server looks for
- added license, for questions please contact me
- v1.1 050531
- requests for ".html" are now tested if a ".txt" file with same name exists. If yes it will redirect to the ".txt" (which will be converted to HTML again) - useful for testing and also packages like the docutils documentation package which uses html links but by default files are ".txt" only
- v1.0 050521
- first release