Using ReStructuredText on App Engine
August 14, 2008
To use docutils in your App Engine application to render ReStructuredText first download the module here and place the docutils
directory and roman.py
in the top-level directory of your application:
$ cd my_appengine_app/ $ wget http://prdownloads.sourceforge.net/docutils/docutils-0.5.tar.gz?download $ tar xvfz docutils-0.5.tar.gz $ mv docutils-0.5/docutils/ docutils-0.5/extras/roman.py . $ rm -rf docutils-0.5*
By default, docutils tries to read configuration files from various locations. But this will ail in the App Engine environment. So you have to disable it by overwriting the default settings:
from docutils.core import publish_parts def someview(request): parts = publish_parts(source=some_rst, writer_name='html4css1', settings_overrides={'_disable_config': True}) return parts['fragment']
If you are using the Django helpers, add
RESTRUCTUREDTEXT_FILTER_SETTINGS = {'_disable_config': True}
in settings.py
to use the restructuredtext
filter. Refer to the Django documentation on how to activate and use this filter.
Comments are closed.