Skip to content

Jinja2 support for Falcon framework

License

Notifications You must be signed in to change notification settings

xakiy/falcon-jinja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

falcon-jinja2

Build Status

Simple jinja2 support for Falcon framework.

Installation

pip install falcon-jinja2

Examples

import falcon

from falcon_jinja2 import FalconTemplate

# NOTE: if you want to change name of folder where your HTML files are defined
# Add `path` argument to the FalconTemplate class
#    Example:
#        falcon_template = FalconTemplate(path='path_to_your_folder')

falcon_template = FalconTemplate()

class FirstResource:
    @falcon_template.render('index.html')
    def on_get(self, req, resp):
        resp.context = {'framework': 'Falcon'}

app = falcon.API()
app.add_route('/first', FirstResource())

TODO

  • Add url_for support
  • Add flash messages support

Contributing

  1. Fork the repository.
  2. Create a branch with feature/fix/cleanup, and create an Pull request.
  3. Have fun :)

About

Jinja2 support for Falcon framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published