Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM python:3
FROM python:3.6

ENV PYTHONUNBUFFERED 1
RUN mkdir /django_mongodb_docker
WORKDIR /django_mongodb_docker
COPY . /django_mongodb_docker/
RUN pip install -r requirements.txt
COPY ./requirements.txt .
RUN pip install -r requirements.txt
COPY . .
16 changes: 9 additions & 7 deletions django_mongodb_docker/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'djongo',
'ENFORCE_SCHEMA': True,
'ENFORCE_SCHEMA': False,
'NAME': 'django_mongodb_docker',
'HOST': 'mongodb',
'PORT': 27017,
'USER': 'root',
'PASSWORD': 'mongoadmin',
'AUTH_SOURCE': 'admin',
'AUTH_MECHANISM': 'SCRAM-SHA-1',
'CLIENT':{
'host': 'mongodb',
'port': 27017,
'username': 'root',
'password': 'mongoadmin',
'authSource': 'admin',
'authMechanism': 'SCRAM-SHA-1',
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ volumes:

services:
mongodb:
image: mongo
image: mongo:3.6
restart: always
volumes:
- ./init-db:/docker-entrypoint-initdb.d
Expand All @@ -26,10 +26,14 @@ services:
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: mongoadmin
ME_CONFIG_MONGODB_SERVER: mongodb
depends_on:
- mongodb

web:
image: app
restart: always
container_name: web
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/django_mongodb_docker
Expand Down
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
django>=2.1.2
djongo==1.2.30
Django==2.2.12
djongo==1.3.2
pymongo==3.6
sqlparse==0.2.4