Skip to content

Commit 63deafb

Browse files
committed
Initial Commit
0 parents  commit 63deafb

File tree

178 files changed

+14642
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+14642
-0
lines changed

Blog/__init__.py

Whitespace-only changes.
157 Bytes
Binary file not shown.
3.5 KB
Binary file not shown.
4.01 KB
Binary file not shown.

Blog/__pycache__/urls.cpython-310.pyc

1.61 KB
Binary file not shown.
2.16 KB
Binary file not shown.

Blog/__pycache__/wsgi.cpython-310.pyc

554 Bytes
Binary file not shown.

Blog/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for Blog project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Blog.settings')
15+
16+
application = get_asgi_application()

Blog/settings.py

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

Blog/settings_local.py

+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
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

Comments
 (0)