React SSR (Backend)
A view for server-side render react apps from Django. Expected to be used in combination with React SSR (Frontend)
Installation
pip install react-ssr
Examples
<!-- 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 %}
# urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
...
url(r"^$" views.HomePageView.as_view(), name="home-page"),
...
]
# 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"
Release files for react-ssr 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| react-ssr-5.0.0.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| react_ssr-5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.7 kB
Release files / react-ssr-5.0.0.tar.gz
| Download URL | react-ssr-5.0.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93fc9b946bb452545733f287f242d6c5796d7a3427ce70fef60f9ebb090fe62c
|
|
BLAKE2b-256 checksum How to use checksums |
a0c06fb1df3f69f7a3ad067402a3436b45e2b302c85f27aa33b10ac81d88f0c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / react_ssr-5.0.0-py3-none-any.whl
| Download URL | react_ssr-5.0.0-py3-none-any.whl |
|---|---|
| Size | 23.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f75d6fd4f3f986d08ddad1a06f4c4f70204ad244a9b47e7c744325be96507ac
|
|
BLAKE2b-256 checksum How to use checksums |
b605bd0360ba7559ac68b309edb5634250fc4a95fb82d19a56db1ac7a40b9372
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|