python-react-v8 editorconfig travis-ci python

Render React.js views server-side

3 years after

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

awesome-cpp

awesome-cpp

A curated list of awesome C/C++ frameworks, libraries, resources, and shiny thin ...

react

react

Event-driven, non-blocking I/O with PHP, formerly known as "Nuclear Reactor writ ...

WebFrontEndStack

WebFrontEndStack

web front end stack: browsers, platforms, libraries, frameworks, tools etc. ...

awesome-javascript

awesome-javascript

A learning guide for JavaScript programmers. ...


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