From 05a66bbbdfd44ca1e239d1596daf2f589e76425d Mon Sep 17 00:00:00 2001 From: kjiyun <112507402+kjiyun@users.noreply.github.com> Date: Wed, 9 Aug 2023 21:07:25 +0900 Subject: [PATCH 1/2] #19 Feat: add env file and settings about env (#20) --- kahluaproject/settings.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/kahluaproject/settings.py b/kahluaproject/settings.py index dc18cbc..4727702 100644 --- a/kahluaproject/settings.py +++ b/kahluaproject/settings.py @@ -11,22 +11,35 @@ """ from datetime import timedelta from pathlib import Path +import os +import environ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent +env = environ.Env(DEBUG=(bool, True)) + +# env_file = os.path.join(BASE_DIR, '.env') +# if os.path.exists(env_file): +# environ.Env.read_env( +# env_file=env_file +# ) + +SECRET_KEY = env('KAHLUA_BE_SECRET_KEY') +STATE = env('KAHLUA_BE_STATE') + +IAMPORT_KEY = env('IAMPORT_KEY') +IAMPORT_SECRET = env('IAMPORT_SECRET') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-wf+#66b*9^o95fbhys1@^#qrrg62y70s_-c!@ebm&fmn)2&gk7' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = ['0.0.0.0', '127.0.0.1', 'localhost'] +# DEBUG = True +ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] # Application definition AUTH_USER_MODEL = 'users.User' @@ -175,8 +188,6 @@ CORS_ORIGIN_ALLOW_ALL = True -IAMPORT_KEY = '6558725881621285' -IAMPORT_SECRET = 'q3kGbRfqy7wE9uHwWewRID1kcm4K8T9ffjjPON7OK28keVM0LVjmesZUFdKu8IM2YGh8CeQRjmcdM3oH' # JWT_AUTH = { # 'JWT_PAYLOAD_HANDLER': From beab4b515bae1f500b74919d5e1a7d59832bd0bb Mon Sep 17 00:00:00 2001 From: kjiyun <112507402+kjiyun@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:07:36 +0900 Subject: [PATCH 2/2] #19 Feat: add NCP secret key in settings.py (#24) * #19 Feat: add env file and settings about env * #19 Feat: add NCP secret key in settings.py --- kahluaproject/settings.py | 5 +++++ users/views/base_views.py | 1 + 2 files changed, 6 insertions(+) diff --git a/kahluaproject/settings.py b/kahluaproject/settings.py index 4727702..d3d4d00 100644 --- a/kahluaproject/settings.py +++ b/kahluaproject/settings.py @@ -30,6 +30,11 @@ IAMPORT_KEY = env('IAMPORT_KEY') IAMPORT_SECRET = env('IAMPORT_SECRET') +NCP_SERVICE_ID = env('NCP_SERVICE_ID') +NCP_SECRET_KEY = env('NCP_SECRET_KEY') +NCP_ACCESS_KEY_ID = env('NCP_ACCESS_KEY_ID') + +SENDER_PHONE_NUM = env('SENDER_PHONE_NUM') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ diff --git a/users/views/base_views.py b/users/views/base_views.py index beb18b0..688ad6b 100644 --- a/users/views/base_views.py +++ b/users/views/base_views.py @@ -6,6 +6,7 @@ from rest_framework import serializers from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.generics import CreateAPIView, GenericAPIView, RetrieveAPIView, UpdateAPIView +from rest_framework_simplejwt.tokens import RefreshToken from drf_yasg import openapi from drf_yasg.utils import swagger_auto_schema