diff --git a/.gitignore b/.gitignore index ef08971..47185bf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /libs .env -.vscode \ No newline at end of file +.vscode +__pycache__ \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 58c25c4..067d4da 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 diff --git a/project/project/__pycache__/__init__.cpython-311.pyc b/project/project/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 6622d38..0000000 Binary files a/project/project/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/project/project/__pycache__/settings.cpython-311.pyc b/project/project/__pycache__/settings.cpython-311.pyc deleted file mode 100644 index 0af2319..0000000 Binary files a/project/project/__pycache__/settings.cpython-311.pyc and /dev/null differ diff --git a/project/project/__pycache__/urls.cpython-311.pyc b/project/project/__pycache__/urls.cpython-311.pyc deleted file mode 100644 index 86592e3..0000000 Binary files a/project/project/__pycache__/urls.cpython-311.pyc and /dev/null differ diff --git a/project/project/__pycache__/wsgi.cpython-311.pyc b/project/project/__pycache__/wsgi.cpython-311.pyc deleted file mode 100644 index 117e8db..0000000 Binary files a/project/project/__pycache__/wsgi.cpython-311.pyc and /dev/null differ diff --git a/project/project/settings.py b/project/project/settings.py index 3853062..20e8ebe 100644 --- a/project/project/settings.py +++ b/project/project/settings.py @@ -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') } } } diff --git a/requirements.txt b/requirements.txt index a6bf869..4115ec0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ django psycopg2-binary djangorestframework -coreapi \ No newline at end of file +coreapi +python-decouple \ No newline at end of file