diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..48ca22e --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,28 @@ +name: Main CD + +on: + push: + branches: + - main + +jobs: + cd: + runs-on: ubuntu-latest + steps: + - name: 서버 배포 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.key }} + script: | + set -e + cd /home/ubuntu/weaverse/weaverse-backend/ + git pull origin main + + source venv/bin/activate + pip install -r requirements.txt + + python manage.py collectstatic --noinput + + sudo systemctl restart weaverse diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7b88996 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: Dev CI + +on: + pull_request: + branches: + - dev + - main + +jobs: + ci: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + + steps: + - name: 체크아웃 레포지토리 + uses: actions/checkout@v3 + + - name: 파이썬 설정 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: 의존성 설치 + run: | + python -m pip install --upgrade pip + pip install --upgrade pip + pip install -r requirements.txt + + - name: github scrests를 사용하여 환경 변수 복사 + run: | + echo "SECRET_KEY=${{ secrets.env }}" >> .env + - name: migrate 실행 + run: | + python manage.py migrate + - name: 테스트 실행 + run: | + python manage.py test diff --git a/accounts/urls.py b/accounts/urls.py index e911349..969e67e 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -5,8 +5,8 @@ app_name = "accounts" urlpatterns = [ - path("users/", views.user_list_create, name="user-list-create"), - path("users//", views.user_retrieve_update_delete, name="user-detail"), - path("users/counts/", views.user_count, name="user-count"), - path("managers/", views.manager_list_create, name="manager-list-create"), + path("users/", views.student_list_create, name="user-list-create"), + path("users//", views.student_retrieve_update_delete, name="user-detail"), + path("users/counts/", views.student_count, name="user-count"), + path("managers/", views.tutor_list_create, name="manager-list-create"), ] diff --git a/requirements.txt b/requirements.txt index 687cadf..6289c02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,10 +21,11 @@ mypy==1.11.2 mypy-extensions==1.0.0 packaging==24.1 pillow==10.4.0 -pip==24.0 pluggy==1.5.0 -psycopg-binary==3.2.2 +pip==24.0 PyJWT==2.9.0 +psycopg==3.2.2 +psycopg-binary==3.2.2 pycparser==2.22 pytest==8.3.3 pytest-django==4.9.0 diff --git a/weaverse/settings.py b/weaverse/settings.py index 440c90f..1ed7d5e 100644 --- a/weaverse/settings.py +++ b/weaverse/settings.py @@ -113,6 +113,17 @@ USE_TZ = True STATIC_URL = "static/" +STATIC_ROOT = os.getenv("STATIC_ROOT", BASE_DIR / "static") + +STATICFILES_DIRS = os.getenv("STATICFILES_DIRS") +if STATICFILES_DIRS: + STATICFILES_DIRS = [path.strip() for path in STATICFILES_DIRS.split(",")] +else: + STATICFILES_DIRS = [BASE_DIR / "staticfiles"] + +CSRF_TRUSTED_ORIGINS = [ + "https://www.weaverse.site", +] DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"