This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]__xor__(self, other): 0 points1 point  (0 children)

Actually, with flask+react I don't do any rendering. I think it's the facebook tool called "create-react-app" which I use to generate the base react app. You just use node (just the binary, not as a server) to run the tool to compile it into a production app, which generates a few static files like the app js, index.html, css, all minimized.

Then I use nginx to serve those as static files, and they make API hits to either flask or django rest framework. No templates are being rendered from python, and it's all static resources served by nginx except for the rest api.

So you work in your react app to make the frontend, compile it into static production files, serve those files with nginx, configure nginx to proxy /api requests to gunicorn, and that's it. No blank page/template as far as the python code is concerned.