Skip to content

운영 배포 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
633a131
Fix: 존재하지 않는 기능의 status 조회시 서버 오류가 발생하지 않게 수정
hanlee55 Feb 25, 2023
b63ab64
Style: Isort 준수를 위한 import 순서 변경
hanlee55 Feb 25, 2023
b1712fd
Merge pull request #35 from hanlee55/devdev
emscb Feb 25, 2023
c6d5b8d
fix: fix typo
pers0n4 Mar 1, 2023
e02a44a
add: program app 추가 및 발표 관련 db 모델링 추가
golony6449 Mar 1, 2023
9aa3c0d
isort
golony6449 Mar 1, 2023
6e579c5
Merge pull request #36 from pers0n4/hotfix/user-model-str-method
golony6449 Mar 1, 2023
03f81e5
Merge pull request #37 from golony6449/feature/init-program
golony6449 Mar 1, 2023
e0929b9
update: 모델 설계 갱신
golony6449 Mar 1, 2023
bdc6845
Merge pull request #38 from golony6449/feature/init-program
golony6449 Mar 1, 2023
691bf7a
Edit comments, model help texts
emscb Mar 1, 2023
e04873c
Add: Program 앱 Serializer 추가
2chanhaeng Mar 1, 2023
46b9cc7
Update: Serializer 일부 항목 제외
2chanhaeng Mar 1, 2023
498c64a
Merge pull request #40 from 2chanhaeng/devdev
golony6449 Mar 1, 2023
79373c1
build: add `pyproject.toml` for formatters configuration
pers0n4 Mar 1, 2023
4be792f
ci: update formatter cli options
pers0n4 Mar 1, 2023
7e06ba4
Add: CODEOWNERS 추가
2chanhaeng Mar 1, 2023
415a04e
Merge pull request #44 from 2chanhaeng/devdev
golony6449 Mar 1, 2023
1093740
Merge pull request #43 from pers0n4/hotfix/formatter-configuration
golony6449 Mar 1, 2023
aa26d23
update: available 필드 추가
golony6449 Mar 3, 2023
d408157
Merge pull request #45 from golony6449/golony/feature/sponsor
golony6449 Mar 3, 2023
ec4ec12
fix: available 조건 수정
golony6449 Mar 3, 2023
0eda505
isort
golony6449 Mar 3, 2023
8e8308a
black
golony6449 Mar 3, 2023
da25064
Merge pull request #46 from golony6449/golony/feature/sponsor
golony6449 Mar 3, 2023
9adc611
Merge pull request #39 from emscb/devdev
golony6449 Mar 3, 2023
f92f81f
Edit github pr template
emscb Mar 4, 2023
6703f97
update: CORS-ALLOW ALL
golony6449 Mar 5, 2023
596c9b2
Merge pull request #48 from golony6449/feature/allow-cors
golony6449 Mar 5, 2023
66811b5
update: APPEND_SLASH set False
golony6449 Mar 5, 2023
6a11148
Merge pull request #49 from golony6449/feature/allow-cors
golony6449 Mar 5, 2023
73606b4
update: remove trail slash
golony6449 Mar 5, 2023
2aa2155
Merge pull request #50 from golony6449/feature/allow-cors
golony6449 Mar 5, 2023
09c78ef
update: URL trailing
golony6449 Mar 5, 2023
23ef53d
downgrade django-storage
golony6449 Mar 5, 2023
d3e677b
Revert "downgrade django-storage"
golony6449 Mar 5, 2023
ea66622
update: custom storage
golony6449 Mar 5, 2023
9b65283
update: custom storage
golony6449 Mar 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @pythonkr/PyConKR-2023
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
### 목표
*

### 작업내용
### 작업 내용
*

### 유의사항
* 리뷰어는 `PyConKR-2023`을 지정 해 주세요.
### 유의 사항
* 리뷰어는 `PyConKR-2023`을 지정해주세요.
* 작업한 내용을 상세하게 작성해주세요.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_on_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: psf/black@stable
with:
options: "--check --verbose --exclude migrations"
options: "--check --verbose"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_on_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: psf/black@stable
with:
options: "--check --verbose --exclude migrations"
options: "--check --verbose"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull-request-merge-precondition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:

- uses: psf/black@stable
with:
options: "--check --verbose --exclude migrations"
options: "--check --verbose"

- uses: isort/isort-action@master
with:
configuration: "--check-only --diff --profile black"
configuration: "--check-only --diff"
requirementsFiles: "requirements.txt"

- name: install dependencies
Expand Down
Empty file added program/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions program/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions program/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ProgramConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "program"
Empty file.
89 changes: 89 additions & 0 deletions program/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from django.contrib.auth import get_user_model
from django.db import models

User = get_user_model()


class ProposalCategory(models.Model):
name = models.CharField(max_length=100, db_index=True)
visible = models.BooleanField(default=True)

def __str__(self):
return self.name


class Proposal(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)

title = models.CharField(max_length=255)
brief = models.TextField(max_length=1000, help_text="리뷰용: 발표에 대한 간단한 설명.")
desc = models.TextField(max_length=4000, help_text="리뷰용: 발표에 대한 자세한 설명")
comment = models.TextField(
max_length=4000, null=True, blank=True, help_text="리뷰용: 파준위에게 전하고 싶은 말"
)

difficulty = models.CharField(
max_length=15,
choices=(
("BEGINNER", "Beginner"),
("INTERMEDIATE", "Intermediate"),
("EXPERIENCED", "Experienced"),
),
)

duration = models.CharField(
max_length=15,
choices=(
("SHORT", "25min"),
("LONG", "40min"),
),
)

language = models.CharField(
max_length=15,
choices=(
("", "---------"),
("KOREAN", "Korean"),
("ENGLISH", "English"),
),
default="",
)

category = models.ForeignKey(
ProposalCategory,
on_delete=models.SET_DEFAULT,
null=True,
blank=True,
default=14,
)
accepted = models.BooleanField(default=False)
introduction = models.TextField(
max_length=2000,
null=True,
blank=True,
help_text="발표 소개 페이지에 들어가는 내용입니다. 변경 사항은 최대 60분 이내에 적용됩니다.",
)
video_url = models.CharField(
max_length=255, null=True, blank=True, help_text="발표 영상 URL"
)
slide_url = models.CharField(
max_length=255, null=True, blank=True, help_text="발표 자료 URL"
)
room_num = models.CharField(
max_length=15,
null=True,
blank=True,
help_text="발표장소",
choices=(
("101", "101"),
("102", "102"),
("103", "103"),
("104", "104"),
("105", "105"),
),
)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

def __str__(self):
return self.title
45 changes: 45 additions & 0 deletions program/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from rest_framework.serializers import ModelSerializer

from program.models import Proposal, ProposalCategory


class ProposalSerializer(ModelSerializer):
class Meta:
model = Proposal
fields = [
"user",
"title",
"brief",
"desc",
"comment",
"difficulty",
"duration",
"language",
"category",
"accepted",
"introduction",
"video_url",
"slide_url",
"room_num",
]


class ProposalListSerializer(ModelSerializer):
class Meta:
model = Proposal
fields = [
"title",
"brief",
"difficulty",
"duration",
"language",
"category",
]


class ProposalCategorySerializer(ModelSerializer):
class Meta:
model = ProposalCategory
fields = [
"name",
]
3 changes: 3 additions & 0 deletions program/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions program/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
9 changes: 7 additions & 2 deletions pyconkr/settings-dev.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from pyconkr.settings import *
from pyconkr.storage import *

DEBUG = True

Expand All @@ -22,8 +23,12 @@

# django-storages: S3
del MEDIA_ROOT
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
STATICFILES_STORAGE = "storages.backends.s3boto3.S3StaticStorage"
# DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
# STATICFILES_STORAGE = "storages.backends.s3boto3.S3StaticStorage"

DEFAULT_FILE_STORAGE = "pyconkr.storage.MediaStorage"
STATICFILES_STORAGE = "pyconkr.storage.StaticStorage"

AWS_S3_ACCESS_KEY_ID = os.getenv("AWS_S3_ACCESS_KEY_ID")
AWS_S3_SECRET_ACCESS_KEY = os.getenv("AWS_S3_SECRET_ACCESS_KEY")
AWS_DEFAULT_REGION = "ap-northeast-2"
Expand Down
6 changes: 6 additions & 0 deletions pyconkr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
APPEND_SLASH = False

ALLOWED_HOSTS = []

Expand All @@ -47,11 +48,14 @@
"status",
# swagger
"drf_spectacular",
# cors
"corsheaders",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
Expand Down Expand Up @@ -170,3 +174,5 @@
# available SwaggerUI versions: https://github.com/swagger-api/swagger-ui/releases
"SWAGGER_UI_DIST": "//unpkg.com/swagger-ui-dist@3.35.1",
}

CORS_ALLOW_ALL_ORIGINS = True
12 changes: 12 additions & 0 deletions pyconkr/storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.conf import settings
from storages.backends.s3boto3 import S3Boto3Storage, S3StaticStorage


class MediaStorage(S3Boto3Storage):
def _get_security_token(self):
return None


class StaticStorage(S3StaticStorage):
def _get_security_token(self):
return None
4 changes: 2 additions & 2 deletions pyconkr/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
path("api-auth/", include("rest_framework.urls")),
path("summernote/", include("django_summernote.urls")),
path("admin/", admin.site.urls),
path("sponsors/", include(sponsor.routers.get_router().urls)),
path("status/", include(status.urls)),
path("sponsors", include(sponsor.routers.get_router().urls)),
path("status", include(status.urls)),
]

if settings.DEBUG is True:
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tool.black]
line-length = 88
include = '\.pyi?$'
extend-exclude = '''
(
migrations
)
'''

[tool.isort]
extend_skip = ["migrations"]
profile = "black"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Pillow==9.4.0
django-constance==2.9.1
django-picklefield==3.1
drf-spectacular==0.25.1
django-cors-headers==3.14.0
14 changes: 7 additions & 7 deletions sponsor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SponsorLevel(models.Model):
)
visible = models.BooleanField(default=True)
price = models.IntegerField(default=0)
limit = models.IntegerField(default=0, help_text="후원사 등급 별 구좌수")
limit = models.IntegerField(default=0, help_text="후원사 등급별 구좌 수")
order = models.IntegerField(default=1)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
Expand Down Expand Up @@ -64,8 +64,8 @@ class Meta:

creator = models.ForeignKey(
User,
null=True, # TODO: 추루 로그인 적용 후 입력
blank=True, # TODO: 추루 로그인 적용 후 입력
null=True, # TODO: 추후 로그인 적용 후 입력
blank=True, # TODO: 추후 로그인 적용 후 입력
on_delete=models.CASCADE,
help_text="후원사를 등록한 유저",
related_name="sponsor_creator",
Expand Down Expand Up @@ -110,7 +110,7 @@ class Meta:
max_length=100,
null=True,
blank=True,
help_text="후원사 사업자 등록번호입니다. 세금 계산서 발급에 사용됩니다.",
help_text="후원사 사업자 등록 번호입니다. 세금 계산서 발급에 사용됩니다.",
)
business_registration_file = models.FileField(
null=True,
Expand All @@ -123,13 +123,13 @@ class Meta:
null=True,
blank=True,
upload_to=bank_book_file_upload_to,
help_text="후원사 사업자 등록증 스캔본입니다. 세금 계산서 발급에 사용됩니다.",
help_text="후원사 통장 사본입니다.",
)
url = models.CharField(
max_length=255,
null=True,
blank=True,
help_text="파이콘 홈페이지에 공개되는 후원사 홈페이지 주소입니다.",
help_text="파이콘 한국 홈페이지에 공개되는 후원사 홈페이지 주소입니다.",
)
logo_image = SorlImageField(
upload_to=logo_image_upload_to,
Expand All @@ -150,5 +150,5 @@ class Meta:
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

def __str_(self):
def __str__(self):
return f"{self.name}/{self.level}"
4 changes: 2 additions & 2 deletions sponsor/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

def get_router():
router = DefaultRouter()
router.register("remaining", SponsorRemainingAccountViewSet, basename="remaining")
router.register("prospectus", SponsorLevelViewSet, basename="prospectus")
router.register("/remaining", SponsorRemainingAccountViewSet, basename="remaining")
router.register("/prospectus", SponsorLevelViewSet, basename="prospectus")
router.register("", SponsorViewSet, basename="sponsor")

return router
Loading