1+ """
2+ Django settings for djang_website project.
3+
4+ Generated by 'django-admin startproject' using Django 3.1.7.
5+
6+ For more information on this file, see
7+ https://docs.djangoproject.com/en/3.1/topics/settings/
8+
9+ For the full list of settings and their values, see
10+ https://docs.djangoproject.com/en/3.1/ref/settings/
11+ """
12+
13+ from pathlib import Path
14+
15+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
16+ BASE_DIR = Path (__file__ ).resolve ().parent .parent
17+
18+
19+ # Quick-start development settings - unsuitable for production
20+ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
21+
22+ # SECURITY WARNING: keep the secret key used in production secret!
23+ SECRET_KEY = '(c@9=wl&3=c#nm@=5#hn$#dpw5zqm0vvmojfcr!d7%&7&ofz2n'
24+
25+ # SECURITY WARNING: don't run with debug turned on in production!
26+ DEBUG = True
27+
28+ ALLOWED_HOSTS = []
29+
30+
31+ # Application definition
32+
33+ INSTALLED_APPS = [
34+ 'django.contrib.admin' ,
35+ 'django.contrib.auth' ,
36+ 'django.contrib.contenttypes' ,
37+ 'django.contrib.sessions' ,
38+ 'django.contrib.messages' ,
39+ 'django.contrib.staticfiles' ,
40+ # Add our new application
41+ 'main' ,
42+ 'users' ,
43+ 'tinymce' ,
44+ 'fontawesomefree' ,
45+ 'crispy_forms' ,
46+ 'captcha' ,
47+ ]
48+
49+ AUTH_USER_MODEL = 'users.CustomUser'
50+
51+ MIDDLEWARE = [
52+ 'django.middleware.security.SecurityMiddleware' ,
53+ 'django.contrib.sessions.middleware.SessionMiddleware' ,
54+ 'django.middleware.common.CommonMiddleware' ,
55+ 'django.middleware.csrf.CsrfViewMiddleware' ,
56+ 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
57+ 'django.contrib.messages.middleware.MessageMiddleware' ,
58+ 'django.middleware.clickjacking.XFrameOptionsMiddleware' ,
59+ ]
60+
61+ ROOT_URLCONF = 'djang_website.urls'
62+
63+ TEMPLATES = [
64+ {
65+ 'BACKEND' : 'django.template.backends.django.DjangoTemplates' ,
66+ 'DIRS' : [],
67+ 'APP_DIRS' : True ,
68+ 'OPTIONS' : {
69+ 'context_processors' : [
70+ 'django.template.context_processors.debug' ,
71+ 'django.template.context_processors.request' ,
72+ 'django.contrib.auth.context_processors.auth' ,
73+ 'django.contrib.messages.context_processors.messages' ,
74+ ],
75+ },
76+ },
77+ ]
78+
79+ WSGI_APPLICATION = 'djang_website.wsgi.application'
80+
81+
82+ # Database
83+ # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
84+
85+ DATABASES = {
86+ 'default' : {
87+ 'ENGINE' : 'django.db.backends.sqlite3' ,
88+ 'NAME' : BASE_DIR / 'db.sqlite3' ,
89+ }
90+ }
91+
92+
93+ # Password validation
94+ # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
95+
96+ AUTH_PASSWORD_VALIDATORS = [
97+ {
98+ 'NAME' : 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator' ,
99+ },
100+ {
101+ 'NAME' : 'django.contrib.auth.password_validation.MinimumLengthValidator' ,
102+ },
103+ {
104+ 'NAME' : 'django.contrib.auth.password_validation.CommonPasswordValidator' ,
105+ },
106+ {
107+ 'NAME' : 'django.contrib.auth.password_validation.NumericPasswordValidator' ,
108+ },
109+ ]
110+
111+
112+ # Internationalization
113+ # https://docs.djangoproject.com/en/3.1/topics/i18n/
114+
115+ LANGUAGE_CODE = 'en-us'
116+
117+ TIME_ZONE = 'UTC'
118+
119+ USE_I18N = True
120+
121+ USE_L10N = True
122+
123+ USE_TZ = True
124+
125+
126+ # Static files (CSS, JavaScript, Images)
127+ # https://docs.djangoproject.com/en/3.1/howto/static-files/
128+
129+ STATIC_URL = '/static/'
130+
131+ CRISPY_TEMPLATE_PACK = 'bootstrap4'
132+
133+ LOGIN_REDIRECT_URL = '/'
134+ LOGIN_URL = 'login'
135+
136+ AUTHENTICATION_BACKENDS = ['users.backends.EmailBackend' ]
137+
138+ RECAPTCHA_PUBLIC_KEY = '6LddA3kgAAAAAPf1mAJmEc7Ku0cssbD5QMha09NT'
139+ RECAPTCHA_PRIVATE_KEY = '6LddA3kgAAAAAJY-2-Q0J3QX83DFJwFR1hXqmN8q'
140+ SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error' ]
141+
142+ TINYMCE_DEFAULT_CONFIG = {
143+ 'custom_undo_redo_levels' : 100 ,
144+ 'selector' : 'textarea' ,
145+ "menubar" : "file edit view insert format tools table help" ,
146+ 'plugins' : 'link image preview codesample contextmenu table code lists fullscreen' ,
147+ 'toolbar1' : 'undo redo | backcolor casechange permanentpen formatpainter removeformat formatselect fontselect fontsizeselect' ,
148+ 'toolbar2' : 'bold italic underline blockquote | alignleft aligncenter alignright alignjustify '
149+ '| bullist numlist | outdent indent | table | link image | codesample | preview code | tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry' ,
150+ 'contextmenu' : 'formats | link image' ,
151+ 'block_formats' : 'Paragraph=p; Header 1=h1; Header 2=h2' ,
152+ 'fontsize_formats' : "8pt 10pt 12pt 14pt 16pt 18pt" ,
153+ 'content_style' : "body { font-family: Arial; background: white; color: black; font-size: 12pt}" ,
154+ 'codesample_languages' : [
155+ {'text' : 'Python' , 'value' : 'python' }, {'text' : 'HTML/XML' , 'value' : 'markup' },],
156+ 'image_class_list' : [{'title' : 'Fluid' , 'value' : 'img-fluid' , 'style' : {} }],
157+ 'width' : 'auto' ,
158+ "height" : "600px" ,
159+ 'image_caption' : True ,
160+ }
0 commit comments