You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
4.9 KiB
178 lines
4.9 KiB
"""
|
|
Django settings for Blog project.
|
|
|
|
Generated by 'django-admin startproject' using Django 4.2.6.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/4.2/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/4.2/ref/settings/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'django-insecure-#=y33(%iph8jpue&-fx*2l-eumd4&^cm=9$jtq9q#=kt%3!^r('
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'jazzmin',
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'tinymce',
|
|
'crispy_forms',
|
|
'crispy_bootstrap5',
|
|
'comment',
|
|
'mptt',
|
|
'user',
|
|
'article'
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'Blog.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [BASE_DIR / 'templates']
|
|
,
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'Blog.context_processors.current_url',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'Blog.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': BASE_DIR / 'db.sqlite3',
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'zh-Hans'
|
|
|
|
TIME_ZONE = 'Asia/Shanghai'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = True
|
|
|
|
AUTH_USER_MODEL = "user.User"
|
|
LOGIN_URL = "/user/user_login/"
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
|
|
|
STATIC_URL = 'static/'
|
|
STATICFILES_DIRS = [BASE_DIR / "static"]
|
|
MEDIA_URL = 'media/'
|
|
MEDIA_ROOT = Path(BASE_DIR, 'media')
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
|
|
CRISPY_TEMPLATE_PACK = "bootstrap5"
|
|
TINYMCE_DEFAULT_CONFIG = {
|
|
"selector": 'textarea', # change this value according to your HTML
|
|
"images_upload_url": '/upload_image/', # Django路由中图片上传地址
|
|
"height": 500,
|
|
"plugins": [
|
|
'advlist autolink lists link image charmap print preview anchor',
|
|
'searchreplace visualblocks code fullscreen',
|
|
'insertdatetime media table paste code help wordcount'
|
|
],
|
|
"menubar": 'favs file edit view insert format tools table help',
|
|
"toolbar": 'undo redo | formatselect | ' +
|
|
'bold italic backcolor | alignleft aligncenter ' +
|
|
'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
'code image | ' +
|
|
'removeformat | help',
|
|
"language": 'zh_CN',
|
|
"paste_data_images": True,
|
|
|
|
"image_class_list": [
|
|
{"title": 'Responsive', "value": 'tinymce-image'}
|
|
]
|
|
}
|
|
|
|
X_FRAME_OPTIONS = 'SAMEORIGIN'
|
|
JAZZMIN_SETTINGS = {
|
|
"site_title": "博客管理系统",
|
|
"site_header": "博客管理系统",
|
|
"site_brand": "博客管理系统",
|
|
"welcome_sign": "博客管理系统",
|
|
"icons": {
|
|
"user.User": "fas fa-user",
|
|
"article.Category": "fa fa-th-list",
|
|
"article.Article": "fa fa-server",
|
|
"article.Tag": "fa fa-tags",
|
|
"comment.Comment": "fa fa-comment",
|
|
},
|
|
} |