diff --git a/FINAL with LMH.md b/FINAL with LMH.md index d911b8a09..f3c7760dc 100644 --- a/FINAL with LMH.md +++ b/FINAL with LMH.md @@ -23,7 +23,17 @@ npm i vue-chartjs chart.js ``` +프로필 이미지 +https://ordinary-code.tistory.com/170 + +https://dongyeopgu.github.io/django/django_image_upload.html + +구글 계정으로 로그인 + +``` +https://medium.com/chanjongs-programming-diary/django-rest-framework%EB%A1%9C-%EC%86%8C%EC%85%9C-%EB%A1%9C%EA%B7%B8%EC%9D%B8-api-%EA%B5%AC%ED%98%84%ED%95%B4%EB%B3%B4%EA%B8%B0-google-kakao-github-2ccc4d49a781 +``` diff --git a/PJT_FINAL/.idea/PJT_FINAL.iml b/PJT_FINAL/.idea/PJT_FINAL.iml new file mode 100644 index 000000000..d0876a78d --- /dev/null +++ b/PJT_FINAL/.idea/PJT_FINAL.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PJT_FINAL/.idea/inspectionProfiles/profiles_settings.xml b/PJT_FINAL/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/PJT_FINAL/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/PJT_FINAL/.idea/modules.xml b/PJT_FINAL/.idea/modules.xml new file mode 100644 index 000000000..8370d412f --- /dev/null +++ b/PJT_FINAL/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PJT_FINAL/.idea/vcs.xml b/PJT_FINAL/.idea/vcs.xml new file mode 100644 index 000000000..6c0b86358 --- /dev/null +++ b/PJT_FINAL/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PJT_FINAL/.idea/workspace.xml b/PJT_FINAL/.idea/workspace.xml new file mode 100644 index 000000000..c3f90ae87 --- /dev/null +++ b/PJT_FINAL/.idea/workspace.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1668772853094 + + + + + + + \ No newline at end of file diff --git a/PJT_FINAL/django_final/accounts/__pycache__/views.cpython-310.pyc b/PJT_FINAL/django_final/accounts/__pycache__/views.cpython-310.pyc index 1851f3355..0c5d25c76 100644 Binary files a/PJT_FINAL/django_final/accounts/__pycache__/views.cpython-310.pyc and b/PJT_FINAL/django_final/accounts/__pycache__/views.cpython-310.pyc differ diff --git a/PJT_FINAL/django_final/accounts/views.py b/PJT_FINAL/django_final/accounts/views.py index 22290cdb4..a71ed0308 100644 --- a/PJT_FINAL/django_final/accounts/views.py +++ b/PJT_FINAL/django_final/accounts/views.py @@ -6,7 +6,11 @@ from .serializers import * -# Create your views here. +#for profile +import base64 +import os +from datetime import datetime + User = get_user_model() @@ -14,4 +18,19 @@ def profile(request, user_pk): user = get_object_or_404(User, pk=user_pk) serializer = ProfileSerializer(user) - return Response(serializer.data) \ No newline at end of file + return Response(serializer.data) + + + +# @api_view(['POST']) +# def upload_image(request): +# img_string = request.data['img_base64'] # POST요청을 통해 받은 base64정보 +# imgdata = base64.b64decode(img_string) # 디코딩 +# now = datetime.now() +# now = datetime.timestamp(now) +# filename = f'temp_image_{request.user}.jpg' # DB에 저장하지 않고 사용한다음 지우기 위해 +# with open(filename, 'wb') as f: +# f.write(imgdata) # 디코딩한 이미지를 사용하기 위해 잠시 저장 +# #### 이미지를 사용하는 코드 ##### +# os.remove(filename) # 이미지를 사용한 후 삭제 +# return Response({'result' : imgdata}) diff --git a/PJT_FINAL/django_final/db.sqlite3 b/PJT_FINAL/django_final/db.sqlite3 index b48668dd1..bc7a37cf6 100644 Binary files a/PJT_FINAL/django_final/db.sqlite3 and b/PJT_FINAL/django_final/db.sqlite3 differ diff --git a/PJT_FINAL/django_final/django_final/__pycache__/settings.cpython-310.pyc b/PJT_FINAL/django_final/django_final/__pycache__/settings.cpython-310.pyc index a2c25acba..1d7c36afa 100644 Binary files a/PJT_FINAL/django_final/django_final/__pycache__/settings.cpython-310.pyc and b/PJT_FINAL/django_final/django_final/__pycache__/settings.cpython-310.pyc differ diff --git a/PJT_FINAL/django_final/django_final/__pycache__/urls.cpython-310.pyc b/PJT_FINAL/django_final/django_final/__pycache__/urls.cpython-310.pyc index 817f917a6..01c44616d 100644 Binary files a/PJT_FINAL/django_final/django_final/__pycache__/urls.cpython-310.pyc and b/PJT_FINAL/django_final/django_final/__pycache__/urls.cpython-310.pyc differ diff --git a/PJT_FINAL/django_final/django_final/settings.py b/PJT_FINAL/django_final/django_final/settings.py index 91bec6134..08341cf05 100644 --- a/PJT_FINAL/django_final/django_final/settings.py +++ b/PJT_FINAL/django_final/django_final/settings.py @@ -1,9 +1,21 @@ from pathlib import Path +# #google로 로그인 +# import os +# import json +# import sys # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent +# #google로 로그인 +# ROOT_DIR = os.path.dirname(BASE_DIR) +# SECRET_BASE_FILE = os.path.join(BASE_DIR, 'secrets.json') +# secrets = json.loads(open(SECRET_BASE_FILE).read()) +# for key, value in secrets.items(): +# setattr(sys.modules[__name__], key, value) + + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ @@ -46,6 +58,9 @@ # # OpenAPI 3.0 # 'drf_spectacular', + # #google로 로그인 + # 'allauth.socialaccount.providers.google', + 'django.contrib.admin', 'django.contrib.auth', @@ -55,6 +70,24 @@ 'django.contrib.staticfiles', ] +# #google로 로그인 +# SITE_ID = 1 +# ACCOUNT_USER_MODEL_USERNAME_FIELD = True # username 필드 사용 x +# ACCOUNT_EMAIL_REQUIRED = False # email 필드 사용 o +# ACCOUNT_USERNAME_REQUIRED = True # username 필드 사용 x +# ACCOUNT_AUTHENTICATION_METHOD = 'email' + +# REST_USE_JWT = True + +# from datetime import timedelta + +# SIMPLE_JWT = { +# 'ACCESS_TOKEN_LIFETIME': timedelta(hours=2), +# 'REFRESH_TOKEN_LIFETIME': timedelta(days=7), +# 'ROTATE_REFRESH_TOKENS': False, +# 'BLACKLIST_AFTER_ROTATION': True, +# } +# # 여기까지 REST_FRAMEWORK = { # Authentication diff --git a/PJT_FINAL/django_final/movies/__pycache__/serializers.cpython-310.pyc b/PJT_FINAL/django_final/movies/__pycache__/serializers.cpython-310.pyc index 59f4cffef..915953074 100644 Binary files a/PJT_FINAL/django_final/movies/__pycache__/serializers.cpython-310.pyc and b/PJT_FINAL/django_final/movies/__pycache__/serializers.cpython-310.pyc differ diff --git a/PJT_FINAL/django_final/movies/serializers.py b/PJT_FINAL/django_final/movies/serializers.py index c14833490..e9fb97483 100644 --- a/PJT_FINAL/django_final/movies/serializers.py +++ b/PJT_FINAL/django_final/movies/serializers.py @@ -14,7 +14,7 @@ class MovieGenreSerializer(serializers.ModelSerializer): class Meta: model = Movie - fields = ('id', 'title', 'genres', 'overview') + fields = ('id', 'title', 'vote_average', 'genres', 'overview') class TopMovieListSerializer(serializers.ModelSerializer): @@ -31,7 +31,7 @@ class MovieSearchSerializer(serializers.ModelSerializer): class Meta: model = Movie - fields = ('pk', 'overview', 'title', 'poster_path', 'similarity',) + fields = ('pk', 'overview', 'title', 'vote_average', 'poster_path', 'similarity',) # 유저 정보 class UserSerializer(serializers.ModelSerializer): diff --git a/PJT_FINAL/django_final/secrets.json b/PJT_FINAL/django_final/secrets.json new file mode 100644 index 000000000..a48ac3b77 --- /dev/null +++ b/PJT_FINAL/django_final/secrets.json @@ -0,0 +1,5 @@ +{ + "SECRET_KEY" : "secret_key", + "SOCIAL_AUTH_GOOGLE_CLIENT_ID" : "google_client_id", + "SOCIAL_AUTH_GOOGLE_SECRET" : "google_secret_key" +} \ No newline at end of file diff --git a/PJT_FINAL/front_end/src/components/user/login.vue b/PJT_FINAL/front_end/src/components/user/login.vue index c39613262..b1b72c3a5 100644 --- a/PJT_FINAL/front_end/src/components/user/login.vue +++ b/PJT_FINAL/front_end/src/components/user/login.vue @@ -2,6 +2,7 @@
+
E-MAIL
@@ -25,6 +26,12 @@ class="loginButton" :to="{ name: 'userSignUp' }" >간편 회원가입 + google
@@ -32,6 +39,8 @@