LoginSignup
1
2

More than 3 years have passed since last update.

docker環境での django ホットリロード

Posted at

docker-compose.yml

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: backend
    command: 'sh /server/start.sh'
    expose:
      - "8001"
    restart: always
    volumes:
      - ./backend:/server/

djangoプロジェクト内

start.sh

#!/bin/bash
sleep 5
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic --noinput
# ここで読込
uwsgi --ini /server/config/uwsgi.ini

config

uwsgi.ini 作成

[uwsgi]
socket = :8001
module = config.wsgi
wsgi-file = /server/config/wsgi.py
logto = /server/config/uwsgi.log
py-autoreload = 1
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2