FROM python:3.8.1-alpine3.11

WORKDIR /app

# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE
ENV PYTHONDONTWRITEBYTECODE 1

# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUNBUFFERED
ENV PYTHONUNBUFFERED 1

# RUN pip install --upgrade pip

COPY ./requirements.txt /app/

RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt

COPY . /app

# /app/project/wsgi.py
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:80", "project.wsgi"]

ORM

Experience

  • https://coderbook.com/@marcus/add-new-non-null-foreign-key-to-existing-django-model/
  • https://realpython.com/django-redirects/
  • https://stackoverflow.com/questions/28007412/django-foreign-key-to-many-to-many-table