From 66d1aa69f0919d7bb48295809a1282e29f30e715 Mon Sep 17 00:00:00 2001 From: virusdefender Date: Sat, 30 Apr 2016 19:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=A3=8E=E6=A0=BC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/views.py | 3 ++- oj/local_settings.py | 7 ------- oj/server_settings.py | 7 ------- oj/settings.py | 5 +++++ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/admin/views.py b/admin/views.py index f8bc0c5d..deb5ec60 100644 --- a/admin/views.py +++ b/admin/views.py @@ -1,4 +1,5 @@ # coding=utf-8 +import os from django.conf import settings from django.http import HttpResponse, Http404 @@ -7,7 +8,7 @@ from rest_framework.views import APIView class AdminTemplateView(APIView): def get(self, request, template_dir, template_name): - path = settings.TEMPLATES[0]["DIRS"][0] + "/admin/" + template_dir + "/" + template_name + ".html" + path = os.path.join(settings.TEMPLATES[0]["DIRS"][0], "admin", template_dir, template_name + ".html") try: return HttpResponse(open(path).read(), content_type="text/html") except IOError: diff --git a/oj/local_settings.py b/oj/local_settings.py index bd74e353..c42f96fc 100644 --- a/oj/local_settings.py +++ b/oj/local_settings.py @@ -27,13 +27,6 @@ REDIS_QUEUE = { "db": 2 } - -# for celery -BROKER_URL = 'redis://%s:%s/%s' % (REDIS_QUEUE["host"], str(REDIS_QUEUE["port"]), str(REDIS_QUEUE["db"])) -CELERY_ACCEPT_CONTENT = ["json"] -CELERY_TASK_SERIALIZER = "json" - - DEBUG = True ALLOWED_HOSTS = [] diff --git a/oj/server_settings.py b/oj/server_settings.py index 3a566dd1..4deb2480 100644 --- a/oj/server_settings.py +++ b/oj/server_settings.py @@ -36,13 +36,6 @@ REDIS_QUEUE = { "db": 2 } - -# for celery -BROKER_URL = 'redis://%s:%s/%s' % (REDIS_QUEUE["host"], str(REDIS_QUEUE["port"]), str(REDIS_QUEUE["db"])) -CELERY_ACCEPT_CONTENT = ["json"] -CELERY_TASK_SERIALIZER = "json" - - DEBUG = False ALLOWED_HOSTS = ['*'] diff --git a/oj/settings.py b/oj/settings.py index 40f4feb2..0d120afc 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -173,6 +173,11 @@ else: ) } +# for celery +BROKER_URL = 'redis://%s:%s/%s' % (REDIS_QUEUE["host"], str(REDIS_QUEUE["port"]), str(REDIS_QUEUE["db"])) +CELERY_ACCEPT_CONTENT = ["json"] +CELERY_TASK_SERIALIZER = "json" + DATABASE_ROUTERS = ['oj.db_router.DBRouter'] TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/')