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.
159 lines
3.9 KiB
159 lines
3.9 KiB
"""
|
|
Django settings for project.
|
|
|
|
Generated by 'django-admin startproject' using Django 2.1.1.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/2.1/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/2.1/ref/settings/
|
|
"""
|
|
|
|
import os
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'wg*kgsb5$ok23k3t%g)^2mf6++v(o(j1d%-vfd0k(@f(@jg(qh'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ['127.0.0.1', '*']
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.humanize',
|
|
'sorl.thumbnail',
|
|
'chunked_upload',
|
|
'video',
|
|
'users',
|
|
'myadmin',
|
|
'comment',
|
|
]
|
|
|
|
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',
|
|
]
|
|
|
|
SITE_URL = '127.0.0.1'
|
|
|
|
ROOT_URLCONF = 'videoproject.urls'
|
|
|
|
AUTH_USER_MODEL = 'users.User'
|
|
|
|
LOGIN_URL = '/users/login'
|
|
|
|
LOGIN_REDIRECT_URL = '/video/index'
|
|
|
|
THUMBNAIL_DEBUG = True
|
|
|
|
# 文件上传路径
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'upload').replace('\\', '/')
|
|
MEDIA_URL = '/upload/'
|
|
|
|
# 上传视频最大尺寸
|
|
CHUNKED_UPLOAD_MAX_BYTES = 100000000
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
|
|
# 邮件配置
|
|
EMAIL_USE_SSL = True
|
|
EMAIL_HOST = 'smtp.163.com'
|
|
EMAIL_PORT = 465
|
|
EMAIL_HOST_USER = 'xxx@163.com'
|
|
EMAIL_HOST_PASSWORD = 'your pwd'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [os.path.join(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',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
|
|
WSGI_APPLICATION = 'videoproject.wsgi.application'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'video',
|
|
'USER': 'root',
|
|
'PASSWORD': '123456',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
}
|
|
}
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'zh-hans'
|
|
|
|
TIME_ZONE = 'Asia/Shanghai'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = False
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
STATICFILES_DIRS = (
|
|
os.path.join(BASE_DIR, "static"),
|
|
)
|
|
|
|
# STATIC_ROOT = os.path.join(BASE_DIR, "static/")
|