e4c5 / django-react

Painless react with django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Here you will find two simple approaches to integrating react with a django project, the first one inside the folder labeled simple is just a simple django app that does not make use of node.js or create-react-app at all. Instead the jsx is loaded using a script tag along with babel which is used to transpile it. This approach doesn't scale but it's the easiest way to get started if you are not too familiar with the node eco system.

The second approach which you will find in the folder labeled docker, also uses babel. However the transpiling happens at development time and babel is never loaded into the browser. To hide the complexities of node an babel this operation happens inside a docker container.

While there are many ways to add React to a Django project, one approach that is commonly described on websites may not be the most suitable for most web applications. This approach involves running a React front-end on a Node.js server, while also running a Django back-end on a separate server. However, this setup is often unnecessary and more complex than needed for many web apps.

Coming up next we will take a look at how to use django with react but with the node eco system plugged in with minimum of fuss.

About

Painless react with django

License:MIT License


Languages

Language:Python 73.3%Language:JavaScript 18.9%Language:HTML 5.4%Language:Dockerfile 2.4%