|
@@ -15,7 +15,6 @@ 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/dev/howto/deployment/checklist/
|
|
|
|
|
@@ -27,7 +26,7 @@ DEBUG = True
|
|
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
|
|
-APPEND_SLASH=False
|
|
|
+APPEND_SLASH = False
|
|
|
|
|
|
# Application definition
|
|
|
|
|
@@ -35,6 +34,8 @@ INSTALLED_APPS = [
|
|
|
'user',
|
|
|
'order',
|
|
|
'files',
|
|
|
+ 'django_celery_beat',
|
|
|
+ 'django_celery_results',
|
|
|
'corsheaders',
|
|
|
'rest_framework',
|
|
|
'django.contrib.admin',
|
|
@@ -43,6 +44,7 @@ INSTALLED_APPS = [
|
|
|
'django.contrib.sessions',
|
|
|
'django.contrib.messages',
|
|
|
'django.contrib.staticfiles',
|
|
|
+
|
|
|
]
|
|
|
|
|
|
MIDDLEWARE = [
|
|
@@ -76,7 +78,6 @@ TEMPLATES = [
|
|
|
|
|
|
WSGI_APPLICATION = 'admin_site.wsgi.application'
|
|
|
|
|
|
-
|
|
|
# Database
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
|
|
|
|
@@ -88,8 +89,8 @@ DATABASES = {
|
|
|
# 'PASSWORD': '', # 密码
|
|
|
# 'HOST': '127.0.0.1', # mysql服务所在的主机ip
|
|
|
# 'PORT': '3306', # mysql服务端口
|
|
|
- 'ENGINE': 'django.db.backends.sqlite3', # 数据库引擎
|
|
|
- 'NAME': BASE_DIR / 'mysite', # 数据库名,先前创建的
|
|
|
+ 'ENGINE': 'django.db.backends.sqlite3', # 数据库引擎
|
|
|
+ 'NAME': BASE_DIR / 'mysite', # 数据库名,先前创建的
|
|
|
# 'USER': 'root', # 用户名,可以自己创建用户
|
|
|
# 'PASSWORD': '132546tt', # 密码
|
|
|
# 'HOST': 'mysql://gz-cdb-pb7zuqlf.sql.tencentcdb.com', # mysql服务所在的主机ip
|
|
@@ -97,7 +98,6 @@ DATABASES = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
# Password validation
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
|
|
|
|
|
@@ -116,7 +116,6 @@ AUTH_PASSWORD_VALIDATORS = [
|
|
|
},
|
|
|
]
|
|
|
|
|
|
-
|
|
|
# Internationalization
|
|
|
# https://docs.djangoproject.com/en/dev/topics/i18n/
|
|
|
|
|
@@ -128,7 +127,6 @@ USE_I18N = True
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
-
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
# https://docs.djangoproject.com/en/dev/howto/static-files/
|
|
|
|
|
@@ -140,4 +138,15 @@ STATIC_URL = 'static/'
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
|
|
# 允许全部来源
|
|
|
-CORS_ORIGIN_ALLOW_ALL = True # 如果为True,将不使用白名单,并且将接受所有来源。默认为False。
|
|
|
+CORS_ORIGIN_ALLOW_ALL = True # 如果为True,将不使用白名单,并且将接受所有来源。默认为False。
|
|
|
+
|
|
|
+# Celery settings
|
|
|
+
|
|
|
+CELERY_BROKER_URL = 'redis://localhost:6379/1'
|
|
|
+# CELERY_BROKER_URL = BASE_DIR / 'mysite', # 数据库名,先前创建的
|
|
|
+# 'NAME': BASE_DIR / 'mysite', # 数据库名,先前创建的
|
|
|
+#: Only add pickle to this list if your broker is secured
|
|
|
+#: from unwanted access (see userguide/security.html)
|
|
|
+CELERY_ACCEPT_CONTENT = ['json']
|
|
|
+CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite'
|
|
|
+CELERY_TASK_SERIALIZER = 'json'
|