Skip to content

Commit b0cf66b

Browse files
committed
Docs
1 parent c2c46fc commit b0cf66b

File tree

3 files changed

+48
-27
lines changed

3 files changed

+48
-27
lines changed

examples/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
React/Python examples
2+
=====================
3+
4+
[Basic rendering](basic_rendering)
5+
6+
Illustrates how to pre-render React components from python. It illustrates how to use React as a
7+
substitute for python template layers.
8+
9+
--------------------------------------
10+
11+
[python-webpack examples](https://github.com/markfinger/python-webpack/tree/master/examples)
12+
13+
Illustrates how to use python-webpack to integrate React assets into a python system.
14+
15+
--------------------------------------
16+
17+
[Self mounting components](self_mounting_components)
18+
19+
Illustrates a workflow where webpack is used to generate bundles so that the root React component
20+
can immediately mount itself over the markup that was pre-rendered with the same data.
21+
22+
This workflow is similar to what was provided in older versions of python-react. It can be useful
23+
if you want to add interactivity to an otherwise backend-heavy site.
24+
25+
Be aware that while this workflow can be initially convenient, it tends to rely on components maintaining
26+
large amounts of state. A better workflow is for your components to minimize state by delegating all
27+
data storage to external services. If you're looking for something to handle your data, the multitude
28+
of Flux implementations are a reasonable starting point.
29+
30+
--------------------------------------
31+
32+
*Feel free to open a pull request, if you'd like to contribute more examples or links*

examples/basic_rendering/README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
python + react - simple rendering
2-
=================================
3-
4-
This is a basic example that illustrates how to pre-render React components from python. In effect,
5-
it illustrates how to use React as a substitute for python template layers.
6-
7-
8-
### Running the example
1+
Running the example
2+
===================
93

104
Install the dependencies
115

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
python + react - self mounting components
2-
=========================================
3-
4-
This example illustrates a workflow where webpack is used to generate bundles so that the root React
5-
component can immediately mount itself over the markup that was pre-rendered with the same data.
6-
7-
This workflow is similar to what was provided in older versions of python-react. It can be useful
8-
if you want to add a little interactivity to an otherwise backend-heavy site.
9-
10-
Be aware that while this workflow can be initially convenient, it tends to rely on components maintaining
11-
large amounts of state. A better workflow is for your components to minimize state by delegating all
12-
data storage to external services. If you're looking for something to handle your data, the multitude
13-
of Flux implementations are a reasonable starting point.
14-
15-
16-
### Running the example
1+
Running the example
2+
===================
173

184
Install the dependencies
195

@@ -22,10 +8,10 @@ pip install -r requirements.txt
228
npm install
239
```
2410

25-
Start the server
11+
Start the webpack-build server
2612

2713
```
28-
node server.js
14+
npm run webpack-build
2915
```
3016

3117
Start the python server
@@ -34,4 +20,13 @@ Start the python server
3420
python example.py
3521
```
3622

37-
And visit [http://127.0.0.1:5000](http://127.0.0.1:5000)
23+
And visit [http://127.0.0.1:5000](http://127.0.0.1:5000)
24+
25+
----------------------
26+
27+
With `DEBUG = True`, the render server is unneeded. In production you would also want to start
28+
the render server.
29+
30+
```
31+
node server.js
32+
````

0 commit comments

Comments
 (0)