GithubHelp home page GithubHelp logo

forestario / django-docker-quickstart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from godd0t/django-docker-quickstart

1.0 0.0 0.0 77 KB

Your all-in-one Django-Docker starter kit. Pre-configured services including PostgreSQL, Redis, Celery, with Nginx and Traefik for production. Streamlined development with included tools for testing and formatting.

License: MIT License

Shell 33.79% Python 54.60% Makefile 8.54% Dockerfile 3.07%

django-docker-quickstart's Introduction

Django Docker Quickstart

This quickstart provides an easy way to initiate a Django project using Docker. It comes with pre-configured services including PostgreSQL, Redis, Celery (worker and beat), Nginx, and Traefik, ready to run a Django web application. Additionally, it provides a few handy shortcuts for easier development.


Features ๐Ÿš€

  • Django web application framework
  • PostgreSQL database
  • Redis in-memory data structure store
  • Celery worker and beat services for running background tasks asynchronously
  • Nginx web server for serving static and media files, and proxying requests to the Django application
  • Traefik reverse proxy for routing requests to the appropriate service and providing SSL termination

Included Packages and Tools ๐Ÿ› ๏ธ

  • Pytest: Testing framework
  • Pytest Sugar: A pytest plugin for a better look
  • Pytest Django: A pytest plugin providing useful tools for testing Django applications
  • Coverage: Test coverage tool
  • Ruff: Linter
  • Black: Code formatter

Requirements ๐Ÿ“‹


Getting Started ๐Ÿ

  1. Clone the repository:

    git clone https://github.com/godd0t/django-docker-quickstart.git
  2. Change directory into the project:

    cd django-docker-quickstart
  3. 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

Initial Setup โš™๏ธ

Development Prerequisites

  1. Create a virtual environment:

    python -m venv venv
  2. Activate the virtual environment:

    source venv/bin/activate
  3. (Optional) Install the development requirements specific to your IDE for enhanced functionality and support.

    pip install -r src/requirements-dev.txt
  4. 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:

      make build-dev

You can now access the application at http://localhost:8000. The development environment allows for immediate reflection of code changes.

Production Setup

  1. 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.prod.yml up --build -d
    • If buildkit is enabled, build the image:

       docker-compose -f docker-compose.prod.yml up --build -d
    • Or, use the shortcut:

        make build-prod

Shortcuts ๐Ÿ”‘

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

django-docker-quickstart's People

Contributors

godd0t avatar

Stargazers

Cahaya Lim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.