File tree Expand file tree Collapse file tree 3 files changed +48
-27
lines changed Expand file tree Collapse file tree 3 files changed +48
-27
lines changed Original file line number Diff line number Diff line change
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*
Original file line number Diff line number Diff line change 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
+ ===================
9
3
10
4
Install the dependencies
11
5
Original file line number Diff line number Diff line change 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
+ ===================
17
3
18
4
Install the dependencies
19
5
@@ -22,10 +8,10 @@ pip install -r requirements.txt
22
8
npm install
23
9
```
24
10
25
- Start the server
11
+ Start the webpack-build server
26
12
27
13
```
28
- node server.js
14
+ npm run webpack-build
29
15
```
30
16
31
17
Start the python server
@@ -34,4 +20,13 @@ Start the python server
34
20
python example.py
35
21
```
36
22
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
+ ````
You can’t perform that action at this time.
0 commit comments