Skip to content

Commit

Permalink
Merge pull request #38 from hyao/patch-1
Browse files Browse the repository at this point in the history
add an example of Flask integration into the Frameworks section of docs
  • Loading branch information
Maxim Avanov committed Oct 22, 2014
2 parents 8943b01 + a914ab5 commit 0c3b317
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/en/frameworks.txt
Expand Up @@ -25,6 +25,39 @@ added via the ``config.add_plim_renderer()`` directive:
The renderer will load its configuration from a provided mako prefix in the Pyramid
settings dictionary. The default prefix is 'mako.'.

Flask
======

The following code snippet would get Flask working with plim:

.. code-block:: python

from flask import Flask
from flask.ext.mako import MakoTemplates, render_template
from plim import preprocessor

app = Flask(__name__)
mako = MakoTemplates(app)
app.config['MAKO_PREPROCESSOR'] = preprocessor

@app.route('/')
def hello():
return render_template('hello.html', name='mako')

if __name__ == "__main__":
app.run(debug=True)

With hello.html in templates dir:

.. code-block:: html
doctype html
html
head
title hello ${name}
body
p hello ${name}



Syntax Highlighters
======================
Expand Down

0 comments on commit 0c3b317

Please sign in to comment.