This project is implemented with https://python-webpack-boilerplate.readthedocs.io/en/latest/setup_with_django/
Many of the examples available on internet about react django integration suggests to create a production build and import the static files to django template. This approach has a limitation that the components in production builds are anonymized and hence difficult to debug. This implementation provides an integration to provide proper development environment for react. The Python Webpack Boilerplate package provides a hassle free boilerplate for webpack integration with django. This has been utilized to generate the react boilerplate.
- Generated the boilerplate following the instructions in this link.
- Remove unnecessary packages.
- Install react, react-dom, babel preset for react.
- Make necessary changes in webpack config.
- Configure react hot loader.
- In project root folder, run
pip install -r requirements.txt
. - In frontend folder, run
npm install
. - Run
python manage.py runserver
in root directory. - Run
npm start
in frontend directory.
- Run
npm run build
. The geneated static files are already inported in template.