Overview
The django-react-boilerplate is a boilerplate for Django applications with frontend SPAs. It is built by Labcodes and currently uses React and Vite to manage the frontend. The boilerplate is equipped with features such as PWA (Progressive Web Apps) support, HMR (Hot Module Replacement), and code splitting. Although it is still in beta, any bugs that arise can be reported through the issue tracking system.
Features
- PWA (Progressive Web Apps) support
- HMR (Hot Module Replacement)
- Code splitting
- Easy installation and setup
- Seamless integration with Django and React
- Development and testing aids
- Support for adding new dependencies
Installation
- Install the required dependencies:
wgetmakepython>=3.6poetrynodejs>=8.10libpq-dev(required for Ubuntu>=18.04)python3-dev(required for Ubuntu>=18.04)
- Run the following command to download the boilerplate code, set up nvm (Node Version Manager), and install dependencies:
wget <boilerplate_url> make setup - Verify the installation by accessing the server running at
localhost:8000in a browser.
Alternatively, if the setup script doesn’t work or you want to install everything manually:
- Download the zip file of the boilerplate from GitHub.
- Activate the virtualenv by running
poetry shell. - Install all the dependencies by running
make install_dependencies. - Copy the
env.examplefile to.envto provide environment variables to the Django app using python-decouple. - Run
python manage.py migrateto create a dev database. - Finally, run
make runto start both the Vite development server and Django in parallel.
Summary
The django-react-boilerplate is a powerful tool for quickly setting up Django applications with frontend SPAs using React and Vite. It provides features like PWA support, HMR, and code splitting. The installation process is straightforward, and there is also the option to install dependencies manually if needed. The boilerplate offers extensive development and testing support, making it a robust choice for building Django applications with modern frontend technologies.