diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ea9b3fa..80e3ebc 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 @@ -59,8 +66,9 @@ jobs: # Job key: ${{ secrets.AWS_KEY_PEM }} envs: GITHUB_SHA script: | - cd NextPage/ + cd NextPage/backend/ git pull + cd ../ sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml down sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml pull sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d --build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c606990..dce918a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,12 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + - name: Install Dependencies 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 }} diff --git a/backend/settings.py b/backend/settings.py index aab153e..2f17b43 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -12,7 +12,6 @@ import os import sys from pathlib import Path -# from .mysettings import MY_DATABASES, MY_DATABASE_URL, MY_SECRET from dotenv import load_dotenv load_dotenv() # env 파일에 있는 값 얻어오기 @@ -145,16 +144,16 @@ 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'), + 'NAME': os.environ.get('DATABASE_NAME'), + 'USER': os.environ.get('DATABASE_USER'), + 'PASSWORD': os.environ.get('DATABASE_PASSWORD'), + 'HOST': os.environ.get('DATABASE_HOST'), + 'PORT': os.environ.get('DATABASE_PORT'), } } -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') +SECRET_KEY = os.environ.get('SECRET_KEY') # Password validation # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators @@ -226,6 +225,4 @@ DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/' -#정적 파일 불러오기 -STATIC_URL = 'static/' STATIC_ROOT = os.path.join(BASE_DIR, '_static')