diff --git a/docker-compose.yaml b/docker-compose.yaml index 34ab84df92e12f5fe2e2514dbedceaf3f368bef3..afc32a253c7c9e2f51fafb0f396d07b698e31b75 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,3 +18,8 @@ services: image: postgres:latest ports: - "5433:5432" + volumes: + - db-data:/var/lib/postgresql/data + +volumes: + db-data: diff --git a/web/Dockerfile b/web/Dockerfile index 808297d822ece305d65ab7c7d3386750695b5fa4..492397b1681a3a3662308317478d3b9d4b968617 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -2,6 +2,7 @@ FROM python:3.7 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 +ENV WEB_DOCKER 1 WORKDIR /metagenedb diff --git a/web/metagenedb/settings.py b/web/metagenedb/settings.py index b914db1b06a1ec4df7b96832a1b254b9c7ed12c2..11eaf3d76cad99d65d7ec229ff330decdac70fb4 100644 --- a/web/metagenedb/settings.py +++ b/web/metagenedb/settings.py @@ -26,7 +26,7 @@ SECRET_KEY = '01^q5^z**8vfdd$u4&b0w!2thaj=3b93+i*v$&kwmz6&ix6x8)' DEBUG = True # This can be used to toggle between your local testing db (db.sqlite3) and the PostgreSQL backend: -DOCKER = True +DOCKER = os.environ.get('WEB_DOCKER', False) if DEBUG: # This value is not safe for production usage. Refer to the Django documentation for more information. @@ -91,8 +91,11 @@ if DOCKER: else: DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'postgres', + 'USER': 'postgres', + 'HOST': 'localhost', + 'PORT': 5433, } }