Skip to content
Snippets Groups Projects
Commit d0543bd1 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion :recycle:
Browse files

add env variable to specify if web is on docker or not

parent b914eeed
Branches
Tags
No related merge requests found
......@@ -18,3 +18,8 @@ services:
image: postgres:latest
ports:
- "5433:5432"
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
......@@ -2,6 +2,7 @@ FROM python:3.7
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV WEB_DOCKER 1
WORKDIR /metagenedb
......
......@@ -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,
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment