This is an example project for using Django with React and Rest Framework. To test it out yourself, clone the repository and run the following.
- Python 3
- virtualenvwrapper
- git
- NodeJS 4+ with NPM 3+
Setup virtaulwrapper, virtualenv (not required)
mkvirtualenv djr
workon djr
Install dependencies
pip install -r requirements.txt
npm install
Django migrate, create admin user
./manage.py migrate
./manage.py createsuperuser
Run django server
./manage.py runserver
Login to Django Admin, create CMS pages
http://localhost:8040/admin/
In other terminal , compile file and run webpack dev server
./node_modules/.bin/webpack --config webpack.config.js --progress --colors
node server.js
The default home.html
in templates is over ridden by React, Rest API. Any changes made to assets/js/index.jsx
shows in browser.