python-react-v8 editorconfig travis-ci python

Render React.js views server-side

Python-React-V8

Build Status Coverage Status pypi licence

Thin wrapper around v8-cffi to render React views server-side.

Compatibility

What v8-cffi supports

Install

$ pip install python-react-v8

Usage

import react

from my_web_framework import render, orm, runserver


def index(request):
    """A naive implementation for a fake web-framework"""
    data = orm.query().only('name', 'age', 'location')
    react_ = react.React({
        'url': request.get_full_url(),
        'data': data})
    context = {
        'content': react_.render(),
        'data': react_.to_json(data)}

    return render('index.html', context)


if __name__ == '__main__':
    react.set_up() # Initialize V8 machinery
    react.utils.load_libs(['./bundle.js'])
    runserver(index)

Read the docs.

Examples

Build examples

$ make build-examples

Tests

$ make test

License

MIT

Related Repositories

python-react-v8

python-react-v8

Render React.js views server-side ...


Top Contributors

nitely heston

Releases

-   v0.1.5 zip tar
-   v0.1.4 zip tar
-   v0.1.3 zip tar
-   v0.1.2 zip tar
-   v0.1.1 zip tar
-   v0.1.0 zip tar