Skip to content

Commit

Permalink
chore: cors 오류 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
ybkang1108 committed Aug 1, 2024
1 parent 8fc639d commit c26d418
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
remote_key: ${{ secrets.KEY }}

- name: executing remote ssh commands using password
uses: appleboy/ssh-action@develop
uses: appleboy/ssh-action@v0.1.0
with:
host: ${{ secrets.HOST }}
username: ubuntu
Expand Down
2 changes: 1 addition & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class User(AbstractUser):
default="default_profile_pic.jpg", upload_to="profile_pics"
)

reliability = models.IntegerField(default=100)
reliability = models.SmallIntegerField(default=100)

USERNAME_FIELD = "email"
REQUIRED_FIELDS = ["name"]
Expand Down
27 changes: 27 additions & 0 deletions mustgou/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"django.contrib.staticfiles",
"rest_framework",
"rest_framework.authtoken",
"corsheaders",
"accounts",
"friends",
"restaurants",
Expand All @@ -55,6 +56,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"corsheaders.middleware.CorsMiddleware",
]

ROOT_URLCONF = "mustgou.urls"
Expand Down Expand Up @@ -118,6 +120,31 @@
]
}

# CORS 관련 추가(모든 포트 허용)
CORS_ALLOW_ALL_ORIGINS = True

# HTTP methods 추가
CORS_ALLOW_METHODS = {
"DELETE",
"GET",
"OPTIONS",
"PATCH",
"POST",
"PUT",
}

CORS_ALLOW_HEADERS = {
"accept",
"accept-encoding",
"authorization",
"content-type",
"dnt",
"origin",
"user-agent",
"x-csrftoken",
"x-requested-with",
}


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
Expand Down
41 changes: 38 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
asgiref==3.8.1
blinker==1.4
certifi==2024.7.4
charset-normalizer==3.3.2
cryptography==3.4.8
dbus-python==1.2.18
distro==1.7.0
distro-info==1.1+ubuntu0.1
Django==4.2.14
django-cors-headers==4.4.0
djangorestframework==3.15.2
pillow==10.4.0
pip==24.1.2
gunicorn==22.0.0
httplib2==0.20.2
idna==3.7
importlib-metadata==4.6.4
jeepney==0.7.1
keyring==23.5.0
launchpadlib==1.10.16
lazr.restfulclient==0.14.4
lazr.uri==1.0.6
more-itertools==8.10.0
mysqlclient==2.2.4
netifaces==0.11.0
oauthlib==3.2.0
packaging==24.1
pillow==10.4.0
Pygments==2.11.2
PyGObject==3.42.1
PyJWT==2.3.0
PyMySQL==1.1.1
pyparsing==2.4.7
python-apt==2.4.0+ubuntu3
python-decouple==3.8
PyYAML==5.4.1
requests==2.32.3
SecretStorage==3.3.1
setuptools==70.0.0
six==1.16.0
sqlparse==0.5.0
typing_extensions==4.12.2
gunicorn==22.0.0
ubuntu-advantage-tools==8001
ufw==0.36.1
unattended-upgrades==0.1
urllib3==2.2.2
wadllib==1.3.6
zipp==1.0.0

0 comments on commit c26d418

Please sign in to comment.