This is an example implementation of a fully React-rendered frontend in Django using Hypernova and Create React App.
- In this example to rely fully on
renderReact
provided by Hypernova to initialize components - Components that are used are wrapped in
renderReact
and exported to both Hypernova and client side - We dont use the template tag
react_print
- We remove the DRTT placeholder by adding
no_placeholder=1
to the template tagrender_react
- Python 3.6+
- Node v12.15 or lower (standard-things/esm#868 (comment) prevents us from running Node v12.16+)
- Clone repo
- Create and activate virtualenv
python -m venv venv && source venv/bin/activate
- Install packages
poetry install
- Run migrations and load data
cd django_project
./manage.py migrate
./manage.py loaddata data/questions.json
- Install packages:
cd frontend && npm i
Hypernova is installed along with the frontend dev-server
- Start by compiling assets
cd frontend && npm run build
- Then start the hypernova server
cd frontend && node hypernova-bootstrap.js
(and keep it running) - Finally start the django server:
cd django_project && ./manage.py runserver
Now open http://localhost:8000/ to see a fully working example.
This is a fork of https://github.com/mikaelengstrom/django-react-polls-example