A template for quickly setting up projects with the following items:
- Django backend
- ReactJS (Vite) frontend
- TailwindCSS
To use this template, we require some preliminary setup, such as adding a venv
and installing the node
packages. Follow the below process to complete the setup.
Note: We assume you have the latest versions of node
and python
pre-installed.
- Create a virtual environment in the
/backend
directory:
cd backend
python -m venv venv
- Access the virtual environment:
- Windows users:
venv\Scripts\activate
- Mac/Linux:
source venv\Scripts\activate
- Install the dependencies from the
requirements.txt
file:
pip install -r requirements.txt
- Create a new
.env
file in the root directory and add the following:
DJANGO_SECRET_KEY=[KEY_HERE]
DEBUG_MODE=True
- Generate a new secret key for the project by accessing the Django shell:
django-admin shell
from django.core.management.utils import get_random_secret_key
get_random_secret_key()
-
Copy the secret key into the
.env
file, replacing[KEY_HERE]
. -
Make the initial migrations for the database:
python manage.py makemigrations
python manage.py migrate
Note: makemigrations
will return no changes detected
.
- Check everything works (should see
hello world!
):
python manage.py runserver
- Install the node packages:
npm install
- Check it works (should see
Home
underscored and bold):
npm run dev