Merge branch 'new-arch' into otp-auth
* new-arch: fix error package name and add pip mirrorwq 废弃 huey,多数据库连接的时候存在 connection 无法释放的问题,回到 celery 修复 huey 队列不会释放数据库连接的问题,是用法不对 修复typo 完善 sso 登录部分 修复typo 规范配置文件写法;数据库用户名也在环境变量中取 个人博客链接前面也增加图标 修改判题机器的配置文件 删除不再使用的配置文件 Conflicts: account/views.py
This commit is contained in:
@@ -7,3 +7,8 @@
|
||||
|___/ |___/ |_|
|
||||
https://github.com/QingdaoU/OnlineJudge
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
# This will make sure the app is always imported when
|
||||
# Django starts so that shared_task will use this app.
|
||||
from .celery import app as celery_app
|
||||
19
oj/celery.py
Normal file
19
oj/celery.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oj.settings')
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
app = Celery('oj')
|
||||
|
||||
# Using a string here means the worker will not have to
|
||||
# pickle the object when using Windows.
|
||||
app.config_from_object('django.conf:settings')
|
||||
|
||||
# load task modules from all registered Django app configs.
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
@@ -28,6 +28,12 @@ REDIS_QUEUE = {
|
||||
"db": 2
|
||||
}
|
||||
|
||||
|
||||
# for celery
|
||||
BROKER_URL = 'redis://%s:%s/%s' % (REDIS_QUEUE["host"], str(REDIS_QUEUE["port"]), str(REDIS_QUEUE["db"]))
|
||||
ACCEPT_CONTENT = ['json']
|
||||
|
||||
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
@@ -37,6 +37,12 @@ REDIS_QUEUE = {
|
||||
"db": 2
|
||||
}
|
||||
|
||||
|
||||
# for celery
|
||||
BROKER_URL = 'redis://%s:%s/%s' % (REDIS_QUEUE["host"], str(REDIS_QUEUE["port"]), str(REDIS_QUEUE["db"]))
|
||||
ACCEPT_CONTENT = ['json']
|
||||
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
@@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/1.8/topics/settings/
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/1.8/ref/settings/
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
import os
|
||||
|
||||
@@ -22,6 +22,9 @@ if ENV == "local":
|
||||
elif ENV == "server":
|
||||
from .server_settings import *
|
||||
|
||||
import djcelery
|
||||
djcelery.setup_loader()
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
@@ -53,7 +56,7 @@ INSTALLED_APPS = (
|
||||
'judge_dispatcher',
|
||||
|
||||
'rest_framework',
|
||||
'huey.djhuey',
|
||||
'djcelery',
|
||||
)
|
||||
|
||||
if DEBUG:
|
||||
@@ -186,14 +189,6 @@ WEBSITE_INFO = {"website_name": "qduoj",
|
||||
"website_footer": u"青岛大学信息工程学院 创新实验室 <a href=\"http://www.miibeian.gov.cn/\">京ICP备15062075号-1</a>",
|
||||
"url": "https://qduoj.com"}
|
||||
|
||||
HUEY = {
|
||||
'backend': 'huey.backends.redis_backend',
|
||||
'name': 'task_queue',
|
||||
'connection': {'host': REDIS_QUEUE["host"], 'port': REDIS_QUEUE["port"], 'db': REDIS_QUEUE["db"]},
|
||||
'always_eager': False, # Defaults to False when running via manage.py run_huey
|
||||
# Options to pass into the consumer when running ``manage.py run_huey``
|
||||
'consumer_options': {'workers': 50},
|
||||
}
|
||||
|
||||
SMTP_CONFIG = {"smtp_server": "smtp.mxhichina.com",
|
||||
"email": "noreply@qduoj.com",
|
||||
|
||||
Reference in New Issue
Block a user