dockerize django app
# syntax=docker/dockerfile:1
FROM python:3
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
dockerize django app
# syntax=docker/dockerfile:1
FROM python:3
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
dockerize django app
version: "3.9"
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
how to deploy django based website using docker
$ docker run -it -p 8020:8020 \
-e DJANGO_SUPERUSER_USERNAME=admin \
-e DJANGO_SUPERUSER_PASSWORD=sekret1 \
-e [email protected] \
django-markdown-editor
Superuser created successfully
[2020-01-24 00:00:47 +0000] [8] [INFO] Starting gunicorn 20.0.4
[2020-01-24 00:00:47 +0000] [8] [INFO] Listening at: http://0.0.0.0:8010 (8)
[2020-01-24 00:00:47 +0000] [8] [INFO] Using worker: sync
[2020-01-24 00:00:47 +0000] [15] [INFO] Booting worker with pid: 15
[2020-01-24 00:00:47 +0000] [16] [INFO] Booting worker with pid: 16
[2020-01-24 00:00:47 +0000] [17] [INFO] Booting worker with pid: 17
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us