Skip to main content

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


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 details)

Uploaded Source

Built Distribution

react_ssr-5.0.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file react-ssr-5.0.0.tar.gz.

File metadata

  • Download URL: react-ssr-5.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for react-ssr-5.0.0.tar.gz
Algorithm Hash digest
SHA256 93fc9b946bb452545733f287f242d6c5796d7a3427ce70fef60f9ebb090fe62c
MD5 ee6c81b15847ac49108cf575c2d5c874
BLAKE2b-256 a0c06fb1df3f69f7a3ad067402a3436b45e2b302c85f27aa33b10ac81d88f0c7

See more details on using hashes here.

File details

Details for the file react_ssr-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: react_ssr-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for react_ssr-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f75d6fd4f3f986d08ddad1a06f4c4f70204ad244a9b47e7c744325be96507ac
MD5 21bbae1ea36246d67934ebc62fa4f325
BLAKE2b-256 b605bd0360ba7559ac68b309edb5634250fc4a95fb82d19a56db1ac7a40b9372

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page