์ฅ๊ณ setting.py
์ฅ๊ณ ํ๋ ์์ํฌ์ ๋ชจ๋ ๊ฐ๋ฐํ๊ฒฝ ์ธํ ์ setting.py ํ์ผ์์ ์ค์ ์ ํ๋ค.
setting.py ํ์ผ์์ ๋ก๊ทธ ์ค์ , APP ๋ฑ๋ก, Templates ์ค์ , DB์ค์ , ๋ค๊ตญ์ด ๋ฐ ์ง์ญ ์๊ฐ ์ค์ , ์ ์ ํ์ผ ์ค์ ๋ฑ์ ๊ด๋ฆฌํ๋ค.
๋ก๊ทธ์ค์
๊ธฐ๋ณธ์ True๋ก ๋์ด์์ด ๊ฐ๋ฐ์ ๋ก๊ทธ์ ๋จ๊ธฐ๊ฒ ๋๋ค.
์ด์์ ๊ผญ False๋ก ๋ณ๊ฒฝ์ ํด์ค๋ค.
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
APP ๋ฑ๋ก
์์ฑํ APP๋ค์ ๋ชจ๋ ๋ฑ๋กํด์ค๋ค.
์ด์ ๊ธ์์ first_app๋ผ๋ APP๋ฅผ ์์ฑํด์ฃผ์๋๋ฐ, ํด๋น APP ๋ฑ๋ก์ INSTALLED_APPS๋ถ๋ถ์ ์ถ๊ฐํด์ค๋ค.
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'first_app',
]
Templates ์ค์
๊ณตํต์ ์ผ๋ก ๋ค์ด๊ฐ๋ html์ฝ๋๋ฅผ ๊ด๋ฆฌํ๊ธฐ ์ํ ํ์ฅํ template๋ค์ ๊ฒฝ๋ก๋ฅผ ์ค์ ํ ์ ์๋ค.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'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',
],
},
},
]
DB์ค์
default๋ก sqllite๋ฅผ ์ฌ์ฉํ๋ค.
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
๋ค๊ตญ์ด ๋ฐ ์ง์ญ ์๊ฐ ์ค์
๊ธฐ๋ณธ ์ค์ ์ LANGUAGE_CODE = "en-us", TIME_ZONE = 'UTC' ๋ก ๋์ด ์๊ณ , ํ๊ธ ํ๊ธฐ๋ฅผ ์ํด ์๋์ ๊ฐ์ด ์์ ํ๋ค.
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'ko-kr'
TIME_ZONE = 'Asia/Seoul'
USE_I18N = True
USE_L10N = True
USE_TZ = True
์ ์ ํ์ผ ์ค์
CSS, JavaScript, Images์ ๊ฐ์ ์ ์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์ค์ ํด์ค๋ค.
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
๋๊ธ