Docker Django React screenshot

Docker Django React

Author Avatar Theme by Cglusky
Updated: 27 Nov 2025
69 Stars

A local dev full-stack template using docker-compose with Django and React.

Categories

Overview

The docker-django-react project is a local development template that combines Django as the backend framework, React as the frontend framework, and NGINX as the server. The project aims to provide an opinionated full-stack setup for developers using Docker-compose. It includes features like hot reload, Django Rest Framework, Docker containers, and support for serving static and media files with NGINX.

Features

  • Django v5 as the backend framework
  • Django Rest Framework for API development
  • Django Rest Framework Simple JWT for authentication
  • PyTest for testing the Django app
  • Create React App for bootstrapping the React frontend
  • Node development server via Docker LTS Alpine image
  • Hot reload for efficient development
  • Postgres database with Docker v16.1 Alpine image
  • NGINX for serving static and media files and handling CORS issues

Installation

To use the docker-django-react project as a project template, follow these steps:

  1. Create a new repository on GitHub without a ReadMe file.
  2. On your local development machine, navigate to your preferred parent directory.
  3. Edit and rename the .env-example file. All services expect to read environment variables from the .env.dev file. Review the example file and change the name to .env.dev. Make sure your .gitignore file handles environment files to avoid committing sensitive information to a public repository.
  4. Build the containers by running the following command:
    docker-compose build
    
    Add the -up flag to bring services up after the build.
  5. Bring the containers up by running the following command:
    docker-compose up -d
    
    Add the -d flag to run the containers in detached mode.
  6. Bring the containers down by running the following command:
    docker-compose down -v
    
    Add the -v flag to also delete named volumes.
  7. To view logs for a specific service, use the following command:
    docker-compose logs <service-name>
    
  8. To enter the shell of a specific container, use the following command (the container must be running):
    docker exec -it <container-name> sh
    

Summary

The docker-django-react project is a local development template that combines Django, React, and NGINX using Docker-compose. It provides a convenient setup for full-stack development, with features like hot reload, Django Rest Framework, and Docker containers. By using NGINX for handling requests and serving files, the template also addresses CORS issues.