-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
""" | ||
Django settings for UpcyProject project. | ||
Generated by 'django-admin startproject' using Django 4.0. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/4.0/ref/settings/ | ||
""" | ||
|
||
from datetime import timedelta | ||
from pathlib import Path | ||
import environ | ||
import os | ||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent | ||
env = environ.Env(DEBUG=(bool, False)) | ||
|
||
# env_file = os.path.join(BASE_DIR, '.env') | ||
# if os.path.exists(env_file): | ||
# environ.Env.read_env( | ||
# env_file=env_file | ||
# ) | ||
environ.Env.read_env(os.path.join(BASE_DIR, '.env')) | ||
|
||
SECRET_KEY = env('UPCY_SECRET_KEY') | ||
|
||
|
||
# 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! | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = ['*',] | ||
|
||
|
||
# Application definition | ||
|
||
DJANGO_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
|
||
] | ||
PROJECT_APPS = [ | ||
"users.apps.UsersConfig", | ||
"core.apps.CoreConfig", | ||
"products.apps.ProductsConfig", | ||
"services.apps.ServicesConfig", | ||
] | ||
THIRD_APPS = [ | ||
] | ||
INSTALLED_APPS = DJANGO_APPS + PROJECT_APPS + THIRD_APPS | ||
|
||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
|
||
AUTH_USER_MODEL = "users.User" | ||
|
||
ACCOUNT_USER_MODEL_USERNAME_FIELD = None | ||
ACCOUNT_EMAIL_REQUIRED = True | ||
ACCOUNT_USERNAME_REQUIRED = False | ||
ACCOUNT_AUTHENTICATION_METHOD = 'email' | ||
|
||
REST_FRAMEWORK = { | ||
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated", ], | ||
"DEFAULT_AUTHENTICATION_CLASSES": [ | ||
"rest_framework_simplejwt.authentication.JWTAuthentication", | ||
"rest_framework.authentication.TokenAuthentication", | ||
"rest_framework.authentication.SessionAuthentication", | ||
], | ||
} | ||
|
||
REST_USE_JWT = True | ||
|
||
SIMPLE_JWT = { | ||
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=10), | ||
'REFRESH_TOKEN_LIFETIME': timedelta(days=28), | ||
'ROTATE_REFRESH_TOKENS': False, # true면 토큰 갱신 시 refresh도 같이 갱신 | ||
'BLACKLIST_AFTER_ROTATION': True, | ||
} | ||
|
||
|
||
ROOT_URLCONF = 'UpcyProject.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'UpcyProject.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': BASE_DIR / 'db.sqlite3', | ||
} | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/4.0/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/4.0/howto/static-files/ | ||
|
||
STATIC_URL = 'static/' | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |