From a3561c40d05e012a7a50b6140f5494796ae317b8 Mon Sep 17 00:00:00 2001 From: kanguk Date: Thu, 25 Jan 2024 21:06:44 +0900 Subject: [PATCH 1/3] =?UTF-8?q?bug=20:=20settings.py=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/settings.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/backend/settings.py b/backend/settings.py index aab153e..d3fbe60 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -12,7 +12,7 @@ import os import sys from pathlib import Path -# from .mysettings import MY_DATABASES, MY_DATABASE_URL, MY_SECRET +from .mysettings import MY_DATABASES, MY_DATABASE_URL, MY_SECRET from dotenv import load_dotenv load_dotenv() # env 파일에 있는 값 얻어오기 @@ -23,7 +23,7 @@ # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ -# SECRET_KEY = MY_SECRET +SECRET_KEY = MY_SECRET # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -136,25 +136,25 @@ # Database # https://docs.djangoproject.com/en/5.0/ref/settings/#databases -# # Neo4j 데이터베이스 설정 -# DATABASE_URL = MY_DATABASE_URL +# Neo4j 데이터베이스 설정 +DATABASE_URL = MY_DATABASE_URL + +# mysql db 연동 +DATABASES = MY_DATABASES + +# DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.mysql', +# 'NAME': os.environ.get('DATABASE_NAME', 'default_db_name'), +# 'USER': os.environ.get('DATABASE_USER', 'default_user'), +# 'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'default_password'), +# 'HOST': os.environ.get('DATABASE_HOST', 'localhost'), +# 'PORT': os.environ.get('DATABASE_PORT', '3306'), +# } +# } # -# # mysql db 연동 -# DATABASES = MY_DATABASES - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': os.environ.get('DATABASE_NAME', 'default_db_name'), - 'USER': os.environ.get('DATABASE_USER', 'default_user'), - 'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'default_password'), - 'HOST': os.environ.get('DATABASE_HOST', 'localhost'), - 'PORT': os.environ.get('DATABASE_PORT', '3306'), - } -} - -DATABASE_URL = os.environ.get('DATABASE_URL', "default_database_url") -SECRET_KEY = os.environ.get('SECRET_KEY', 'default_secret_key') +# DATABASE_URL = os.environ.get('DATABASE_URL', "default_database_url") +# SECRET_KEY = os.environ.get('SECRET_KEY', 'default_secret_key') # Password validation # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators From 8eb0cf9855e07206e4a299f543f4233679c83105 Mon Sep 17 00:00:00 2001 From: kanguk Date: Thu, 25 Jan 2024 21:27:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?bug=20:=20ci/cd=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 17 ++++++++++++----- .github/workflows/ci.yml | 22 ++++++++++++---------- backend/settings.py | 3 ++- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ea9b3fa..4dc7547 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -36,14 +36,21 @@ jobs: # Job # 이미지 빌드를 위해 .env 생성 - name: Setting .env run: | - echo "${{ secrets.ENV }}" >> .env - cat .env + # echo "${{ secrets.ENV }}" >> .env + echo "DATABASE_NAME=${{ secrets.DATABASE_NAME }}" >> .env + echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env + echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env + echo "DATABASE_HOST=${{ secrets.DATABASE_HOST }}" >> .env + echo "DATABASE_PORT=${{ secrets.DATABASE_PORT }}" >> .env + echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env + # ... add other variables + cat .env + # docker-compose에서 사용하는 이미지들을 build, 공식 이미지들은 x - name: Build docker images - run: | - docker-compose -f docker-compose.yml build - docker images + run: docker-compose -f docker-compose.yml build +# docker images # docker hub repository에 이미지들을 push - name: Push docker images diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c606990..3bd21e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,14 +25,16 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + python manage.py migrate - name: Run Tests - env: - DATABASE_NAME: ${{ secrets.DATABASE_NAME }} - DATABASE_USER: ${{ secrets.DATABASE_USER }} - DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} - DATABASE_HOST: ${{ secrets.DATABASE_HOST }} - DATABASE_PORT: ${{ secrets.DATABASE_PORT }} - DATABASE_URL: ${{ secrets.DATABASE_URL }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} - run: | - python manage.py test + run: python manage.py test +# env: +# DATABASE_NAME: ${{ secrets.DATABASE_NAME }} +# DATABASE_USER: ${{ secrets.DATABASE_USER }} +# DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} +# DATABASE_HOST: ${{ secrets.DATABASE_HOST }} +# DATABASE_PORT: ${{ secrets.DATABASE_PORT }} +# DATABASE_URL: ${{ secrets.DATABASE_URL }} +# SECRET_KEY: ${{ secrets.SECRET_KEY }} +# run: | +# python manage.py test diff --git a/backend/settings.py b/backend/settings.py index d3fbe60..e1edb8c 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -12,7 +12,8 @@ import os import sys from pathlib import Path -from .mysettings import MY_DATABASES, MY_DATABASE_URL, MY_SECRET + +from backend.mysettings import MY_DATABASES, MY_DATABASE_URL, MY_SECRET from dotenv import load_dotenv load_dotenv() # env 파일에 있는 값 얻어오기 From a58137b0583793c8067d96b5ac32531b02bbf31d Mon Sep 17 00:00:00 2001 From: kanguk Date: Thu, 25 Jan 2024 21:33:32 +0900 Subject: [PATCH 3/3] =?UTF-8?q?bug=20:=20ci=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bd21e9..5e1c354 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + setup-python-path: true - name: Install Dependencies run: | python -m pip install --upgrade pip