1
+ import os
2
+ import django_heroku
3
+ import dj_database_url
4
+ from decouple import config
5
+ from pathlib import Path
6
+
7
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
8
+ BASE_DIR = Path (__file__ ).resolve ().parent .parent
9
+
10
+ # Quick-start development settings - unsuitable for production
11
+ # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
12
+
13
+ # SECURITY WARNING: keep the secret key used in production secret!
14
+ SECRET_KEY = 'django-insecure-p8*q920vzq=$91%zfcc)=i0%xr99k7$!gw^f^v8b6n19qhuf$j'
15
+
16
+ # SECURITY WARNING: don't run with debug turned on in production!
17
+ DEBUG = True
18
+
19
+ ALLOWED_HOSTS = ['katenblog.herokuapp.com' ]
20
+
21
+
22
+ # Application definition
23
+
24
+ INSTALLED_APPS = [
25
+ 'django.contrib.admin' ,
26
+ 'django.contrib.auth' ,
27
+ 'django.contrib.contenttypes' ,
28
+ 'django.contrib.sessions' ,
29
+ 'django.contrib.messages' ,
30
+ 'django.contrib.staticfiles' ,
31
+ 'app' ,
32
+ 'ckeditor' ,
33
+ 'ckeditor_uploader' ,
34
+ ]
35
+
36
+ MIDDLEWARE = [
37
+ 'django.middleware.security.SecurityMiddleware' ,
38
+ 'whitenoise.middleware.WhiteNoiseMiddleware' ,
39
+ 'django.contrib.sessions.middleware.SessionMiddleware' ,
40
+ 'django.middleware.common.CommonMiddleware' ,
41
+ 'django.middleware.csrf.CsrfViewMiddleware' ,
42
+ 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
43
+ 'django.contrib.messages.middleware.MessageMiddleware' ,
44
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware' ,
45
+ ]
46
+
47
+ ROOT_URLCONF = 'Blog.urls'
48
+
49
+ TEMPLATES = [
50
+ {
51
+ 'BACKEND' : 'django.template.backends.django.DjangoTemplates' ,
52
+ 'DIRS' : ['templates' ],
53
+ 'APP_DIRS' : True ,
54
+ 'OPTIONS' : {
55
+ 'context_processors' : [
56
+ 'django.template.context_processors.debug' ,
57
+ 'django.template.context_processors.request' ,
58
+ 'django.contrib.auth.context_processors.auth' ,
59
+ 'django.contrib.messages.context_processors.messages' ,
60
+ ],
61
+ },
62
+ },
63
+ ]
64
+
65
+ WSGI_APPLICATION = 'Blog.wsgi.application'
66
+
67
+ # Database
68
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
69
+
70
+ # DATABASES = {
71
+ # 'default': {
72
+ # 'ENGINE': 'django.db.backends.sqlite3',
73
+ # 'NAME': BASE_DIR / 'db.sqlite3',
74
+ # }
75
+ # }
76
+
77
+ DATABASES = {
78
+ 'default' : {
79
+ 'ENGINE' : 'django.db.backends.postgresql_psycopg2' ,
80
+ 'NAME' : 'd9q13i5ifu64at' ,
81
+ 'USER' : 'xseqdipnwyfedz' ,
82
+ 'PASSWORD' : 'fb05af4428b270c18a2b80d0cef3c3b7d31e57c7dd62acf884977fc11c8ed69c' ,
83
+ 'HOST' : 'ec2-44-209-57-4.compute-1.amazonaws.com' ,
84
+ 'PORT' : '5432' ,
85
+ }
86
+ }
87
+
88
+
89
+ # Password validation
90
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
91
+
92
+ AUTH_PASSWORD_VALIDATORS = [
93
+ {
94
+ 'NAME' : 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator' ,
95
+ },
96
+ {
97
+ 'NAME' : 'django.contrib.auth.password_validation.MinimumLengthValidator' ,
98
+ },
99
+ {
100
+ 'NAME' : 'django.contrib.auth.password_validation.CommonPasswordValidator' ,
101
+ },
102
+ {
103
+ 'NAME' : 'django.contrib.auth.password_validation.NumericPasswordValidator' ,
104
+ },
105
+ ]
106
+
107
+ # Internationalization
108
+ # https://docs.djangoproject.com/en/4.0/topics/i18n/
109
+
110
+ LANGUAGE_CODE = 'en-us'
111
+
112
+ TIME_ZONE = 'UTC'
113
+
114
+ USE_I18N = True
115
+
116
+ USE_TZ = True
117
+
118
+ # Static files (CSS, JavaScript, Images)
119
+ # https://docs.djangoproject.com/en/4.0/howto/static-files/
120
+
121
+ STATIC_ROOT = os .path .join (BASE_DIR , 'staticfiles' )
122
+ STATIC_URL = '/static/'
123
+
124
+
125
+ STATICFILES_DIRS = [
126
+ os .path .join (BASE_DIR , "static" ),
127
+ ]
128
+ django_heroku .settings (locals ())
129
+
130
+
131
+ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
132
+
133
+
134
+ # Default primary key field type
135
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
136
+
137
+ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
138
+
139
+
140
+
141
+
142
+ from ckeditor .configs import DEFAULT_CONFIG
143
+
144
+ CKEDITOR_UPLOAD_PATH = "static/uploads/"
145
+ CKEDITOR_IMAGE_BACKEND = "pillow"
146
+ CKEDITOR_THUMBNAIL_SIZE = (300 , 300 )
147
+ CKEDITOR_IMAGE_QUALITY = 40
148
+ CKEDITOR_BROWSE_SHOW_DIRS = True
149
+ CKEDITOR_ALLOW_NONIMAGE_FILES = True
150
+ CKEDITOR_UPLOAD_SLUGIFY_FILENAME = False
151
+ CKEDITOR_JQUERY_URL = 'http://libs.baidu.com/jquery/2.0.3/jquery.min.js'
152
+
153
+
154
+ CUSTOM_TOOLBAR = [
155
+ {
156
+ "name" : "document" ,
157
+ "items" : [
158
+ "Styles" , "Format" , "Bold" , "Italic" , "Underline" , "Strike" , "-" ,
159
+ "TextColor" , "BGColor" , "-" ,
160
+ "JustifyLeft" , "JustifyCenter" , "JustifyRight" , "JustifyBlock" ,
161
+ ],
162
+ },
163
+ {
164
+ "name" : "widgets" ,
165
+ "items" : [
166
+ "Undo" , "Redo" , "-" ,
167
+ "NumberedList" , "BulletedList" , "-" ,
168
+ "Outdent" , "Indent" , "-" ,
169
+ "Link" , "Unlink" , "-" ,
170
+ "Image" , "CodeSnippet" , "Table" , "HorizontalRule" , "Smiley" , "SpecialChar" , "-" ,
171
+ "Blockquote" , "-" ,
172
+ "ShowBlocks" , "Maximize" ,
173
+ ],
174
+ },
175
+ ]
176
+ CKEDITOR_CONFIGS = {
177
+ 'default' : {
178
+ 'toolbar' : (
179
+ ['div' , 'Source' , '-' , 'Save' , 'NewPage' , 'Preview' , '-' , 'Templates' ],
180
+ ['Cut' , 'Copy' , 'Paste' , 'PasteText' , 'PasteFromWord' , '-' , 'Print' , 'SpellChecker' , 'Scayt' ],
181
+ ['Undo' , 'Redo' , '-' , 'Find' , 'Replace' , '-' , 'SelectAll' , 'RemoveFormat' ],
182
+ ['Form' , 'Checkbox' , 'Radio' , 'TextField' , 'Textarea' , 'Select' , 'Button' , 'ImageButton' , 'HiddenField' ],
183
+ ['Bold' , 'Italic' , 'Underline' , 'Strike' , '-' , 'Subscript' , 'Superscript' ],
184
+ ['NumberedList' , 'BulletedList' , '-' , 'Outdent' , 'Indent' , 'Blockquote' ],
185
+ ['JustifyLeft' , 'JustifyCenter' , 'JustifyRight' , 'JustifyBlock' ],
186
+ ['Link' , 'Unlink' , 'Anchor' ],
187
+ ['Image' , 'Flash' , 'Table' , 'HorizontalRule' , 'Smiley' , 'SpecialChar' , 'PageBreak' ],
188
+ ['Styles' , 'Format' , 'Font' , 'FontSize' ],
189
+ ['TextColor' , 'BGColor' ],
190
+ ['Maximize' , 'ShowBlocks' , '-' , 'About' , 'pbckcode' ],
191
+ ),
192
+ }
193
+ }
0 commit comments