This project is archived, please get the latest version of the source code from my book Build SPA with React and Wagtail
The demo is also online if you want to check.
This book will teach you how to build a SPA
(single-page application) using React
and Wagtail CMS
.
By the end of this course, you will be able to:
Docker
and use Docker Compose
to do developmentfactory
package to help create test datacreate-react-app
Tailwind CSS
to build clean and responsive UI.React app
work with Wagtail previewdjango-contrib-comments
which support Generic Relations
Tribute.js
to add Mention
and Emoji
support to the comment form.SWR
to build lazy load comment list.Jest
and @testing-library
family of packages.Below command is for Mac, but you can ask Google for help if you use other OS.
$ sudo vi /etc/hosts
# add to the bottom
127.0.0.1 api.local.test
# clear DNS cache
$ sudo killall -HUP mDNSResponder
$ ping www.local.test
You can use code below to run dev application on your local env.
You need Docker and Docker Compose and you can install it here Get Docker
$ git clone https://github.com/AccordBox/wagtail-react-blog react_wagtail
$ cd react_wagtail
$ docker-compose up --build
Now open a new terminal to import data and change password.
$ docker-compose exec web python manage.py load_initial_data
# change password for admin
$ docker-compose exec web python manage.py changepassword admin
Now you can check on
It is recommended to use nvm to install node
on your local env.
$ node -v
v14.17.4
$ cd frontend
$ npm install -g yarn
$ yarn -v
1.22.11
$ yarn install
$ yarn start
Now you can check on