se agrega variables de entorno en conexion de database
parent
4f614678be
commit
caa64562b8
|
@ -3,3 +3,4 @@
|
|||
|
||||
.env
|
||||
.vscode
|
||||
__pycache__
|
|
@ -13,6 +13,13 @@ services:
|
|||
ports:
|
||||
- 4000:8000
|
||||
command: sh /start.sh
|
||||
environment:
|
||||
DBHOST: db
|
||||
DBPORT: 5432
|
||||
DBNAME: database
|
||||
DBUSER: postgres
|
||||
DBPASS: password
|
||||
DBSCHEMA: desarrollo1
|
||||
|
||||
db:
|
||||
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 decouple import config
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
@ -79,13 +80,13 @@ WSGI_APPLICATION = 'project.wsgi.application'
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': 'password',
|
||||
'NAME': 'database',
|
||||
'HOST': config('DBHOST', 'localhost'),
|
||||
'PORT': config('DBPORT', 5432),
|
||||
'USER': config('DBUSER','postgres'),
|
||||
'PASSWORD': config('DBPASS','password'),
|
||||
'NAME': config('DBNAME','database'),
|
||||
'OPTIONS': {
|
||||
'options': '-c search_path=desarrollo1'
|
||||
'options': '-c search_path=' + config('DBSCHEMA', 'public')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@ django
|
|||
psycopg2-binary
|
||||
djangorestframework
|
||||
coreapi
|
||||
python-decouple
|
Loading…
Reference in New Issue