Metadata-Version: 2.1
Name: react-ssr
Version: 5.0.0
Summary: UNKNOWN
Home-page: https://github.com/alexseitsinger/react-ssr-backend
Author: Alex Seitsinger
Author-email: software@alexseitsinger.com
License: BSD 2-Clause License
Project-URL: Documentation, https://github.com/alexseitsinger/react-ssr-backend
Project-URL: Source, https://github.com/alexseitsinger/react-ssr-backend
Project-URL: Tracker, https://github.com/alexseitsinger/react-ssr-backend/issues
Keywords: django,react,server-side rendering
Platform: UNKNOWN
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Classifier: Framework :: Django
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: Django (>=1.11)
Requires-Dist: click

# React SSR (Backend)

A view for server-side render react apps from Django. Expected to be used in
combination with [React SSR (Frontend)](https://github.com/alexseitsinger/react-ssr-frontend)

## Installation

```bash
pip install react-ssr
```

## Examples

```html
<!-- index.html -->
{% extends "react_ssr/base.html" %}

{% load render_bundle from webpack_loader %}
{% load static %}

{% block head %}
    <script>window.__STATE__ == {{ state | safe }};</script>
{% endblock %}

{% block body %}
    <main role="main">{{ html | safe }}</main>
    {% render_bundle "runtime" %}
    {% render_bundle "vendors" %}
    {% render_bundle "client" %}
{% endblock %}
```

```python
# urls.py
from django.conf.urls import url
from . import views

urlpatterns = [
    ...
    url(r"^$" views.HomePageView.as_view(), name="home-page"),
    ...
]
```

```python
# views.py
from react_ssr.views import ReactView

class ReactViewBase(ReactView):
		included_context = ["title", "meta"]

class HomePageView(ReactViewBase):
		page_path = "site/pages/home"
		page_state_path = "site.pages.home"
```


