No project description provided
Project description
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"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
react-ssr-5.0.0.tar.gz
(7.5 kB
view hashes)
Built Distribution
react_ssr-5.0.0-py3-none-any.whl
(23.2 kB
view hashes)
Close
Hashes for react_ssr-5.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f75d6fd4f3f986d08ddad1a06f4c4f70204ad244a9b47e7c744325be96507ac |
|
MD5 | 21bbae1ea36246d67934ebc62fa4f325 |
|
BLAKE2b-256 | b605bd0360ba7559ac68b309edb5634250fc4a95fb82d19a56db1ac7a40b9372 |