This quickstart provides an easy django + React + Docker + Postgres setup to initialize the application.
- Django web application framework
- PostgreSQL database
- React JavaScript library
- Coverage: Test coverage tool
- Ruff: Linter
- Black: Code formatter
- Docker & Docker Compose - Install and Use Docker
- Python 3.11 or higher - Download and install Python
- Node 20 or higher - Download and install
- Make (optional for shortcuts) - Configure and usage of Makefile
-
Clone the repository:
git clone https://github.com/jitender0514/django-quickstart.git
-
Change directory into the project:
cd django-quickstart
-
Copy the
env.example
file to.env
and update the values as needed:- For Linux/macOS:
cp env.example .env
- For Windows (Command Prompt):
Copy-Item -Path env.example -Destination .env
- For Linux/macOS:
-
Copy the
frontend/env.example
file tofrontend/.env
and update the values as needed:- For Linux/macOS:
cp frontend/env.example frontend/.env
- For Windows (Command Prompt):
Copy-Item -Path frontend/env.example -Destination frontend/.env
- For Linux/macOS:
-
Create a virtual environment:
python -m venv ENV
-
Activate the virtual environment:
source ENV/bin/activate
-
(Optional) Install the development requirements specific to your IDE for enhanced functionality and support [Use
Make
command for easy setup].pip install -r backend/requirements/requirements.dev.txt
-
Build the image and run the container:
-
If buildkit is not enabled, enable it and build the image:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.yml up --build -d
-
If buildkit is enabled, build the image:
docker-compose -f docker-compose.yml up --build -d
-
Or, use the shortcut (
RECOMMENDED
For easy setup)make build-dev
-
You can now access the application at http://localhost:8000. The development environment allows for immediate reflection of code changes.
- Install requirements:
npm install
- Run server:
npm run dev
You can now access the application at http://localhost:5173. (frontend is dependent on backend APIs, make sure backend is running)
This project includes several shortcuts to streamline the development process:
-
Create migrations:
make make-migrations
-
Run migrations:
make migrate
-
Run the linter:
make lint
-
Run the formatter:
make format
-
Run the tests:
make test
-
Create a super user:
make super-user
-
Build and run dev environment:
make build-dev
-
Build and run prod environment:
make build-prod