se agrega variables de entorno en conexion de database
parent
4f614678be
commit
caa64562b8
|
@ -2,4 +2,5 @@
|
||||||
/libs
|
/libs
|
||||||
|
|
||||||
.env
|
.env
|
||||||
.vscode
|
.vscode
|
||||||
|
__pycache__
|
|
@ -13,6 +13,13 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 4000:8000
|
- 4000:8000
|
||||||
command: sh /start.sh
|
command: sh /start.sh
|
||||||
|
environment:
|
||||||
|
DBHOST: db
|
||||||
|
DBPORT: 5432
|
||||||
|
DBNAME: database
|
||||||
|
DBUSER: postgres
|
||||||
|
DBPASS: password
|
||||||
|
DBSCHEMA: desarrollo1
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from decouple import config
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
@ -79,13 +80,13 @@ WSGI_APPLICATION = 'project.wsgi.application'
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'HOST': 'db',
|
'HOST': config('DBHOST', 'localhost'),
|
||||||
'PORT': 5432,
|
'PORT': config('DBPORT', 5432),
|
||||||
'USER': 'postgres',
|
'USER': config('DBUSER','postgres'),
|
||||||
'PASSWORD': 'password',
|
'PASSWORD': config('DBPASS','password'),
|
||||||
'NAME': 'database',
|
'NAME': config('DBNAME','database'),
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'options': '-c search_path=desarrollo1'
|
'options': '-c search_path=' + config('DBSCHEMA', 'public')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
django
|
django
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
djangorestframework
|
djangorestframework
|
||||||
coreapi
|
coreapi
|
||||||
|
python-decouple
|
Loading…
Reference in New Issue