A zero-fuss way to create non single page apps with react.
Project description
React Pages
A zero-fuss solution for using React for non-SPAs, django and other non-node environments.
- Zero Configuration required.
- Go from development to production with ease.
- Automatically install node using nvm.
- Natively use react in django/flask.
Terminology
Project
The project contains the node.js modules necessary to use react, some other js files, required by react pages itself and the pages you add.
└── project
├── package.json
└── package-lock.json
Page:
A page is a directory containing at least an index.js
file, (and probably other css/js files specific to your application.)
└── page
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── registerServiceWorker.js
QuickStart
$ react-pages project poll_react_pages # create a project
$ cd poll_react_pages
$ react-pages page vote # create a page
$ react-pages develop # development
$ react-pages deploy # production
Django Integration
settings.py
INSTALLED_APPS = [
...
'react_pages_django',
...
]
# Assuming your React Pages project is at BASE_DIR,
REACT_PAGES_PROJECT_DIR = os.path.join(BASE_DIR, 'poll_react_pages')
template.html
{% load react_pages %}
...
{% render_react_page 'vote' %}
...
That's it! React Pages will pick-up the "vote" page from "poll_react_pages" project and do the nessecary work to transpile react code.
Django Context
You can pass django template context varialbes like so -
views.py
context['foo'] = [1, 2, 3]
template.html
{% render_react_page 'vote' foo=foo %}
Then access these anywhere in react code
console.log(foo);
Note: These must be JSON serialize-able
For production, just put DEBUG=False
in settings.py
and relax.
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
Built Distribution
File details
Details for the file react-pages-0.0.6.tar.gz
.
File metadata
- Download URL: react-pages-0.0.6.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e1023666218819ace160642ba446afb7d6ed3bb1fcd906f0315d91ba38286f |
|
MD5 | fdc034b91c41286c44084a7836c29b43 |
|
BLAKE2b-256 | 06853dcf23862b18e3be0e5bd911801a4786c710bd5d804e103877e4ded2168f |
File details
Details for the file react_pages-0.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: react_pages-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 847.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9593caa220eef33240faa0d149f6c614eb4b5f1c28923d427d7542cff7ccd465 |
|
MD5 | 596088f6d8822907a19f00d95cfd88ab |
|
BLAKE2b-256 | cb91971dafd41b174216e77cbaebe7a04a48c792fe2dc5f9c37e8c800a6afdb6 |