Skip to content
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

hotfix: recommend 프로필 이미지 경로 수정 #86

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions accounts/migrations/0008_alter_user_profile_img.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.14 on 2024-08-10 08:07

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("accounts", "0007_alter_user_reliability"),
]

operations = [
migrations.AlterField(
model_name="user",
name="profile_img",
field=models.ImageField(
default="default_profile_img.jpg", upload_to="profile_img/"
),
),
]
2 changes: 1 addition & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class User(AbstractUser):
)

profile_img = models.ImageField(
default="default_profile_img.jpg", upload_to="profile_imgs"
default="default_profile_img.jpg", upload_to="profile_img/"
)

reliability = models.SmallIntegerField(default=80)
Expand Down
12 changes: 2 additions & 10 deletions accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
from django.urls import path, include
from django.urls import path
from .views import (
RegisterView,
LoginView,
LogoutView,
UserViewSet,
DeleteUserView,
profile,
)

# 뷰셋
from rest_framework import routers
from rest_framework_simplejwt.views import TokenRefreshView

router = routers.DefaultRouter()
router.register("list", UserViewSet)

urlpatterns = [
path("register/", RegisterView.as_view()),
path("login/", LoginView.as_view()),
path("logout/", LogoutView.as_view()),
path("test/", include(router.urls)),
path("delete/", DeleteUserView.as_view()),
path("delete-user/", DeleteUserView.as_view()),
path("refresh/", TokenRefreshView.as_view()), # jwt 토큰 재발급
path("profile/", profile, name="profile"),
]
1 change: 1 addition & 0 deletions friends/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def get_common_restaurant_count(self, obj):
class FriendRecommendSerializer(serializers.ModelSerializer):
common_restaurant_count = serializers.SerializerMethodField()
common_restaurants = serializers.SerializerMethodField()
profile_img = serializers.URLField(source="profile_img.url")

class Meta:
model = User
Expand Down
Binary file modified media/default_profile_img.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 6 additions & 18 deletions mustgou/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"django.contrib.staticfiles",
"rest_framework",
"rest_framework_simplejwt",
"rest_framework.authtoken",
"corsheaders",
"accounts",
"friends",
Expand Down Expand Up @@ -117,32 +116,21 @@
},
]

# DRF 로그인 유지를 위해 주석처리
# REST_FRAMEWORK = {
# "DEFAULT_AUTHENTICATION_CLASSES": [
# "rest_framework.authentication.TokenAuthentication",
# ]
# }


REST_FRAMEWORK = {
# "DEFAULT_AUTHENTICATION_CLASSES": [
# "rest_framework_simplejwt.authentication.JWTAuthentication",
# "rest_framework_simplejwt.authentication.JWTAuthentication",
# ],
"DEFAULT_PERMISSION_CLASSES": (
"rest_framework.permissions.IsAuthenticated",
"rest_framework.permissions.IsAdminUser",
"rest_framework.permissions.AllowAny",
),
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
}


JWT_AUTH = {
"JWT_SECRET_KEY": SECRET_KEY,
"JWT_ALGORITHM": "HS256", # 암호화 알고리즘
"JWT_ALLOW_REFRESH": True, # refresh 사용 여부
"JWT_EXPIRATION_DELTA": datetime.timedelta(days=7), # 유효기간 설정
"JWT_REFRESH_EXPIRATION_DELTA": datetime.timedelta(days=28), # JWT 토큰 갱신 유효기간
"JWT_ALGORITHM": "HS256",
"JWT_ALLOW_REFRESH": True,
"JWT_EXPIRATION_DELTA": datetime.timedelta(days=7),
"JWT_REFRESH_EXPIRATION_DELTA": datetime.timedelta(days=28),
}


Expand Down
Loading