Full-stack Django project with React frontend, containerized with Docker for seamless development.
- 🐍 Backend: Django + Django REST Framework + PostgreSQL
- ⚛️ Frontend: React + Vite + Tailwind CSS
- 🐳 Development: Docker + Docker Compose
- ✅ Django: Python code changes restart the server automatically
- ✅ React: Frontend changes update instantly in the browser
- ✅ Database: PostgreSQL with persistent data across restarts
Docker & Docker Compose installed
-
Create environment file ".env" from ".env.example"
-
Start everything with one command
docker-compose up --build -d
- Access your applications
- 🐍 Django: http://localhost:8000
- ⚛️ React Frontend: http://localhost:5173
That's it! Both applications are running with live reloading. 🎉
Apply Django database migrations
docker-compose exec web python manage.py migrate
View logs
docker-compose logs web -f # Django logs
docker-compose logs frontend -f # React logs
Fresh start (removes database data)
docker-compose down -v && docker-compose up --build
Create a superuser for Django admin
docker-compose exec web python manage.py createsuperuser
Access admin at: http://localhost:8000/admin
Analyze and manage your PostgreSQL database using pgAdmin web interface.
- Open pgAdmin: http://localhost:5050
- Login credentials:
- Email:
[email protected]
- Password:
admin
- Email:
- Click "Add New Server" or "Create > Server"
- General tab:
- Name:
Django Playground
(or any name you prefer)
- Name:
- Connection tab:
- Host name/address:
db
- Port:
5432
- Maintenance database:
django_playground
- Username:
django_user
- Password:
django_password
- Host name/address:
- Click "Save"
This project supports both Django development approaches:
- What: Traditional server-side rendered HTML pages
- Access: http://localhost:8000
- Use case: Classic Django web applications with server-side rendering
- What: Django REST Framework APIs + React SPA
- Access:
- API: http://localhost:8000/api/
- Frontend: http://localhost:5173
- Use case: Modern decoupled architecture with React consuming DRF APIs
Run Django REST framework tests
docker-compose exec web python manage.py test -v 2
You can collaborate with me giving a star ⭐️ to the project or
Thanks! 😃