· 4 years ago · Dec 23, 2020, 02:52 AM
1import os # isort:skip
2gettext = lambda s: s
3DATA_DIR = os.path.dirname(os.path.dirname(__file__))
4"""
5Django settings for mysite project.
6
7Generated by 'django-admin startproject' using Django 3.1.4.
8
9For more information on this file, see
10https://docs.djangoproject.com/en/3.1/topics/settings/
11
12For the full list of settings and their values, see
13https://docs.djangoproject.com/en/3.1/ref/settings/
14"""
15
16from pathlib import Path
17
18# Build paths inside the project like this: BASE_DIR / 'subdir'.
19BASE_DIR = Path(__file__).resolve().parent.parent
20
21
22# Quick-start development settings - unsuitable for production
23# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
24
25# SECURITY WARNING: keep the secret key used in production secret!
26SECRET_KEY = '1_5ibo7y7r+rvi3#0rbv(6!^2*(jf4uigncfz8q&3n1f@q6(!%'
27
28# SECURITY WARNING: don't run with debug turned on in production!
29DEBUG = True
30
31ALLOWED_HOSTS = []
32
33
34# Application definition
35
36
37
38
39
40ROOT_URLCONF = 'mysite.urls'
41
42
43
44WSGI_APPLICATION = 'mysite.wsgi.application'
45
46
47# Database
48# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
49
50
51
52
53# Password validation
54# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
55
56AUTH_PASSWORD_VALIDATORS = [
57 {
58 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
59 },
60 {
61 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
62 },
63 {
64 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
65 },
66 {
67 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
68 },
69]
70
71
72# Internationalization
73# https://docs.djangoproject.com/en/3.1/topics/i18n/
74
75LANGUAGE_CODE = 'en'
76
77TIME_ZONE = 'Asia/Ho_Chi_Minh'
78
79USE_I18N = True
80
81USE_L10N = True
82
83USE_TZ = True
84
85
86# Static files (CSS, JavaScript, Images)
87# https://docs.djangoproject.com/en/3.1/howto/static-files/
88
89STATIC_URL = '/static/'
90MEDIA_URL = '/media/'
91MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
92STATIC_ROOT = os.path.join(DATA_DIR, 'static')
93
94STATICFILES_DIRS = (
95 os.path.join(BASE_DIR, 'mysite', 'static'),
96)
97SITE_ID = 1
98
99
100TEMPLATES = [
101 {
102 'BACKEND': 'django.template.backends.django.DjangoTemplates',
103 'DIRS': [os.path.join(BASE_DIR, 'mysite', 'templates'),],
104 'OPTIONS': {
105 'context_processors': [
106 'django.contrib.auth.context_processors.auth',
107 'django.contrib.messages.context_processors.messages',
108 'django.template.context_processors.i18n',
109 'django.template.context_processors.debug',
110 'django.template.context_processors.request',
111 'django.template.context_processors.media',
112 'django.template.context_processors.csrf',
113 'django.template.context_processors.tz',
114 'sekizai.context_processors.sekizai',
115 'django.template.context_processors.static',
116 'cms.context_processors.cms_settings'
117 ],
118 'loaders': [
119 'django.template.loaders.filesystem.Loader',
120 'django.template.loaders.app_directories.Loader'
121 ],
122 },
123 },
124]
125
126
127MIDDLEWARE = [
128 'cms.middleware.utils.ApphookReloadMiddleware',
129 'django.contrib.sessions.middleware.SessionMiddleware',
130 'django.middleware.csrf.CsrfViewMiddleware',
131 'django.contrib.auth.middleware.AuthenticationMiddleware',
132 'django.contrib.messages.middleware.MessageMiddleware',
133 'django.middleware.locale.LocaleMiddleware',
134 'django.middleware.common.CommonMiddleware',
135 'django.middleware.clickjacking.XFrameOptionsMiddleware',
136 'cms.middleware.user.CurrentUserMiddleware',
137 'cms.middleware.page.CurrentPageMiddleware',
138 'cms.middleware.toolbar.ToolbarMiddleware',
139 'cms.middleware.language.LanguageCookieMiddleware'
140]
141
142INSTALLED_APPS = [
143 'djangocms_admin_style',
144 'django.contrib.auth',
145 'django.contrib.contenttypes',
146 'django.contrib.sessions',
147 'django.contrib.admin',
148 'django.contrib.sites',
149 'django.contrib.sitemaps',
150 'django.contrib.staticfiles',
151 'django.contrib.messages',
152 'cms',
153 'menus',
154 'sekizai',
155 'treebeard',
156 'djangocms_text_ckeditor',
157 'filer',
158 'easy_thumbnails',
159 'djangocms_bootstrap4',
160 'djangocms_bootstrap4.contrib.bootstrap4_alerts',
161 'djangocms_bootstrap4.contrib.bootstrap4_badge',
162 'djangocms_bootstrap4.contrib.bootstrap4_card',
163 'djangocms_bootstrap4.contrib.bootstrap4_carousel',
164 'djangocms_bootstrap4.contrib.bootstrap4_collapse',
165 'djangocms_bootstrap4.contrib.bootstrap4_content',
166 'djangocms_bootstrap4.contrib.bootstrap4_grid',
167 'djangocms_bootstrap4.contrib.bootstrap4_jumbotron',
168 'djangocms_bootstrap4.contrib.bootstrap4_link',
169 'djangocms_bootstrap4.contrib.bootstrap4_listgroup',
170 'djangocms_bootstrap4.contrib.bootstrap4_media',
171 'djangocms_bootstrap4.contrib.bootstrap4_picture',
172 'djangocms_bootstrap4.contrib.bootstrap4_tabs',
173 'djangocms_bootstrap4.contrib.bootstrap4_utilities',
174 'djangocms_file',
175 'djangocms_icon',
176 'djangocms_link',
177 'djangocms_picture',
178 'djangocms_style',
179 'djangocms_googlemap',
180 'djangocms_video',
181 'mysite'
182]
183
184LANGUAGES = (
185 ## Customize this
186 ('en', gettext('en')),
187)
188
189CMS_LANGUAGES = {
190 ## Customize this
191 1: [
192 {
193 'code': 'en',
194 'name': gettext('en'),
195 'redirect_on_fallback': True,
196 'public': True,
197 'hide_untranslated': False,
198 },
199 ],
200 'default': {
201 'redirect_on_fallback': True,
202 'public': True,
203 'hide_untranslated': False,
204 },
205}
206
207CMS_TEMPLATES = (
208 ## Customize this
209 ('fullwidth.html', 'Fullwidth'),
210 ('sidebar_left.html', 'Sidebar Left'),
211 ('sidebar_right.html', 'Sidebar Right')
212)
213
214X_FRAME_OPTIONS = 'SAMEORIGIN'
215
216CMS_PERMISSION = True
217
218CMS_PLACEHOLDER_CONF = {}
219
220DATABASES = {
221 'default': {
222 'CONN_MAX_AGE': 0,
223 'ENGINE': 'django.db.backends.sqlite3',
224 'HOST': 'localhost',
225 'NAME': 'project.db',
226 'PASSWORD': '',
227 'PORT': '',
228 'USER': ''
229 }
230}
231
232THUMBNAIL_PROCESSORS = (
233 'easy_thumbnails.processors.colorspace',
234 'easy_thumbnails.processors.autocrop',
235 'filer.thumbnail_processors.scale_and_crop_with_subject_location',
236 'easy_thumbnails.processors.filters'
237)
238