· 4 years ago · Jun 15, 2021, 10:04 AM
1"""
2Django settings for HramKY project.
3
4Generated by 'django-admin startproject' using Django 3.2.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.2/ref/settings/
11"""
12import os
13from pathlib import Path
14
15# Build paths inside the project like this: BASE_DIR / 'subdir'.
16BASE_DIR = Path(__file__).resolve().parent.parent
17
18# Quick-start development settings - unsuitable for production
19# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
20
21# SECURITY WARNING: keep the secret key used in production secret!
22SECRET_KEY = 'django-insecure-4^%i263^$5pu@d&z@(f__he3oal0h3!^&3z2!+47e3gb$5_mvl'
23
24# SECURITY WARNING: don't run with debug turned on in production!
25DEBUG = True
26
27ALLOWED_HOSTS = []
28
29# Application definition
30
31INSTALLED_APPS = [
32 'app',
33 'django.contrib.admin',
34 'django.contrib.auth',
35 'django.contrib.contenttypes',
36 'django.contrib.sessions',
37 'django.contrib.messages',
38 'django.contrib.staticfiles',
39]
40
41MIDDLEWARE = [
42 'django.middleware.security.SecurityMiddleware',
43 'django.contrib.sessions.middleware.SessionMiddleware',
44 'django.middleware.common.CommonMiddleware',
45 'django.middleware.csrf.CsrfViewMiddleware',
46 'django.contrib.auth.middleware.AuthenticationMiddleware',
47 'django.contrib.messages.middleware.MessageMiddleware',
48 'django.middleware.clickjacking.XFrameOptionsMiddleware',
49]
50
51ROOT_URLCONF = 'HramKY.urls'
52
53TEMPLATES = [
54 {
55 'BACKEND': 'django.template.backends.django.DjangoTemplates',
56 'DIRS': [BASE_DIR / 'templates']
57 ,
58 'APP_DIRS': True,
59 'OPTIONS': {
60 'context_processors': [
61 'django.template.context_processors.debug',
62 'django.template.context_processors.request',
63 'django.contrib.auth.context_processors.auth',
64 'django.contrib.messages.context_processors.messages',
65 ],
66 },
67 },
68]
69
70WSGI_APPLICATION = 'HramKY.wsgi.application'
71
72# Database
73# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
74
75DATABASES = {
76 'default': {
77 'ENGINE': 'django.db.backends.postgresql_psycopg2',
78 'NAME': 'hram',
79 'USER': 'postgres',
80 'PASSWORD': 'admin',
81 'HOST': '127.0.0.1',
82 'PORT': '5432',
83 }
84}
85
86# Password validation
87# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
88
89AUTH_PASSWORD_VALIDATORS = [
90 {
91 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
92 },
93 {
94 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
95 },
96 {
97 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
98 },
99 {
100 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
101 },
102]
103
104# Internationalization
105# https://docs.djangoproject.com/en/3.2/topics/i18n/
106
107LANGUAGE_CODE = 'en-us'
108
109TIME_ZONE = 'UTC'
110
111USE_I18N = True
112
113USE_L10N = True
114
115USE_TZ = True
116
117# Static files (CSS, JavaScript, Images)
118# https://docs.djangoproject.com/en/3.2/howto/static-files/
119
120STATIC_URL = '/static/'
121
122# Default primary key field type
123# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
124
125DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
126
127MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
128
129STATIC_ROOT = os.path.join(BASE_DIR, "static")
130
131SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
132
133STATICFILES_DIRS = [
134 os.path.join(BASE_DIR, "static/css/"),
135 os.path.join(BASE_DIR, "static/images/"),
136 os.path.join(BASE_DIR, "static/js/"),
137 os.path.join(SITE_ROOT, "static/"),
138]
139
140STATIC_BASE_PATH = STATIC_ROOT
141MEDIA_URL = '/media/'
142