settings.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. """
  2. Django settings for MyBlog project.
  3. Generated by 'django-admin startproject' using Django 2.0.13.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/2.0/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/2.0/ref/settings/
  8. """
  9. import os
  10. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = '+b9j*+2q8py+20_#8tntnkoxz21t5wl&5m6d)zjcvovb6p@(&9'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = []
  19. # Application definition
  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. 'article',
  28. 'userprofile',
  29. 'password_reset',
  30. 'comment',
  31. 'taggit',
  32. 'ckeditor',
  33. ]
  34. MIDDLEWARE = [
  35. 'django.middleware.security.SecurityMiddleware',
  36. 'django.contrib.sessions.middleware.SessionMiddleware',
  37. 'django.middleware.common.CommonMiddleware',
  38. 'django.middleware.csrf.CsrfViewMiddleware',
  39. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  40. 'django.contrib.messages.middleware.MessageMiddleware',
  41. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  42. ]
  43. ROOT_URLCONF = 'MyBlog.urls'
  44. TEMPLATES = [
  45. {
  46. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  47. 'DIRS': [os.path.join(BASE_DIR, '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. WSGI_APPLICATION = 'MyBlog.wsgi.application'
  60. # Database
  61. # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
  62. DATABASES = {
  63. 'default': {
  64. 'ENGINE': 'django.db.backends.sqlite3',
  65. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  66. }
  67. }
  68. # Password validation
  69. # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
  70. AUTH_PASSWORD_VALIDATORS = [
  71. {
  72. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  73. },
  74. {
  75. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  76. },
  77. {
  78. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  79. },
  80. {
  81. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  82. },
  83. ]
  84. # Internationalization
  85. # https://docs.djangoproject.com/en/2.0/topics/i18n/
  86. LANGUAGE_CODE = 'en-us'
  87. TIME_ZONE = 'Asia/Shanghai'
  88. USE_I18N = True
  89. USE_L10N = True
  90. USE_TZ = True
  91. # Static files (CSS, JavaScript, Images)
  92. # https://docs.djangoproject.com/en/2.0/howto/static-files/
  93. STATIC_URL = '/static/'
  94. STATICFILES_DIRS = (
  95. os.path.join(BASE_DIR, "static"),
  96. )
  97. # SMTP服务器,改为你的邮箱的smtp!
  98. EMAIL_HOST = 'smtp.exmail.qq.com'
  99. # 改为你自己的邮箱名!
  100. EMAIL_HOST_USER = 'Shellmiao@shellmiao.com'
  101. # 你的邮箱密码
  102. EMAIL_HOST_PASSWORD = 'K77o2eE5hpHBYRYy'
  103. # 发送邮件的端口
  104. EMAIL_PORT = 25
  105. # 是否使用 TLS
  106. EMAIL_USE_TLS = True
  107. # 默认的发件人
  108. DEFAULT_FROM_EMAIL = 'Shellmiao的博客 <Shellmiao@shellmiao.com>'
  109. MEDIA_URL = '/media/'
  110. MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
  111. CKEDITOR_CONFIGS = {
  112. # django-ckeditor默认使用default配置
  113. 'default': {
  114. # 编辑器宽度自适应
  115. 'width': 'auto',
  116. 'height': '250px',
  117. # tab键转换空格数
  118. 'tabSpaces': 4,
  119. # 工具栏风格
  120. 'toolbar': 'Custom',
  121. # 工具栏按钮
  122. 'toolbar_Custom': [
  123. # 表情 代码块
  124. ['Smiley', 'CodeSnippet'],
  125. # 字体风格
  126. ['Bold', 'Italic', 'Underline', 'RemoveFormat', 'Blockquote'],
  127. # 字体颜色
  128. ['TextColor', 'BGColor'],
  129. # 链接
  130. ['Link', 'Unlink'],
  131. # 列表
  132. ['NumberedList', 'BulletedList'],
  133. # 最大化
  134. ['Maximize']
  135. ],
  136. # 加入代码块插件
  137. 'extraPlugins': ','.join(['codesnippet', 'prism', 'widget', 'lineutils']),
  138. }
  139. }