diff --git a/oj/local_settings.py b/oj/local_settings.py index 196c5ad..dede6c1 100644 --- a/oj/local_settings.py +++ b/oj/local_settings.py @@ -18,7 +18,7 @@ DATABASES = { 'NAME': 'oj_submission', 'ENGINE': 'django.db.backends.mysql', 'HOST': "121.42.32.129", - 'POST': 3306, + 'PORT': 3306, 'USER': 'root', 'PASSWORD': 'mypwd', 'CONN_MAX_AGE': 0.1, @@ -30,7 +30,7 @@ DEBUG = True # 同理 这是 web 服务器的上传路径 TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/') -DATABASE_ROUTERS = ['oj.db_router.DBRouter'] +ALLOWED_HOSTS = [] ALLOWED_HOSTS = [] diff --git a/oj/server_settings.py b/oj/server_settings.py index 0395846..185bf6b 100644 --- a/oj/server_settings.py +++ b/oj/server_settings.py @@ -5,31 +5,33 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 下面是需要自己修改的 -LOG_PATH = "log/" +LOG_PATH = "/var/log/oj/" # 注意这是web 服务器访问的地址,判题端访问的地址不一定一样,因为可能不在一台机器上 DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.mysql', + 'NAME': "oj", + 'CONN_MAX_AGE': 0.1, + 'HOST': '127.0.0.1', + 'PORT': 3306, + 'USER': 'root', + 'PASSWORD': 'mypwd' }, - # submission 的 name 和 engine 请勿修改,其他代码会用到 'submission': { 'NAME': 'oj_submission', 'ENGINE': 'django.db.backends.mysql', - 'HOST': "121.42.32.129", - 'POST': 3306, - 'USER': 'root', - 'PASSWORD': 'mypwd', 'CONN_MAX_AGE': 0.1, + 'HOST': "127.0.0.1", + 'PORT': 3306, + 'USER': 'root', + 'PASSWORD': 'mypwd' } } -DEBUG = False +DEBUG = True # 同理 这是 web 服务器的上传路径 -TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/') +TEST_CASE_DIR = '/root/test_case/' -DATABASE_ROUTERS = ['oj.db_router.DBRouter'] - -ALLOWED_HOSTS = ['*'] \ No newline at end of file +ALLOWED_HOSTS = ['*'] diff --git a/oj/settings.py b/oj/settings.py index 05cddc8..097a4c2 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -164,4 +164,6 @@ LOGGING = { REST_FRAMEWORK = { 'TEST_REQUEST_DEFAULT_FORMAT': 'json' -} \ No newline at end of file +} + +DATABASE_ROUTERS = ['oj.db_router.DBRouter'] \ No newline at end of file diff --git a/static/src/js/app/admin/contest/contestList.js b/static/src/js/app/admin/contest/contestList.js index f63cdcc..4135fce 100644 --- a/static/src/js/app/admin/contest/contestList.js +++ b/static/src/js/app/admin/contest/contestList.js @@ -149,8 +149,16 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", vm.editingContestId = contestId; vm.editTitle = vm.contestList[contestId-1].title; vm.editPassword = vm.contestList[contestId-1].password; - vm.editStartTime = vm.contestList[contestId-1].start_time.substring(0,16).replace("T"," "); - vm.editEndTime = vm.contestList[contestId-1].end_time.substring(0,16).replace("T"," "); + //var startTime = new Date(), endTime = new Date(); + //startTime.setFullYear(parseInt(vm.contestList[contestId-1].start_time.substring(0,4))) + //startTime.setMonth(parseInt(vm.contestList[contestId-1].start_time.substring(5,7))) + //startTime.setDate(parseInt(vm.contestList[contestId-1].start_time.substring(8,10))) + //startTime.setHours(parseInt(vm.contestList[contestId-1].start_time.substring(11,13))) + //startTime.setMinutes(parseInt(vm.contestList[contestId-1].start_time.substring(14,16))) + //startTime = new Date(startTime + 8 * 60 * 60 * 1000) + + vm.editStartTime = add8Hours(vm.contestList[contestId-1].start_time); + vm.editEndTime = add8Hours(vm.contestList[contestId-1].end_time);//.substring(0,16).replace("T"," "); vm.editMode = vm.contestList[contestId-1].mode; vm.editVisible = vm.contestList[contestId-1].visible; if (vm.contestList[contestId-1].contest_type == 0) { //contest type == 0, contest in group @@ -291,6 +299,40 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", } }); } + + function add8Hours(UtcString) { + console.log(UtcString); + var M = [31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + /*time.setFullYear(parseInt(UtcString.substring(0,4))) + time.setMonth(parseInt(UtcString.substring(5,7))) + time.setDate(parseInt(UtcString.substring(8,10))) + time.setHours(parseInt(UtcString.substring(11,13))) + time.setMinutes(parseInt(UtcString.substring(14,16))) + time = new Date(time + 8 * 60 * 60 * 1000)*/ + var year =UtcString.substring(0,4); + var month =UtcString.substring(5,7); + var day =UtcString.substring(8,10); + var hour =parseInt(UtcString.substring(11,13)) + 8; + var minute = UtcString.substring(14,16); + if (hour > 23) { + hour -= 24; day = parseInt(day)+1; month = parseInt(month); + if (month == 2) if (!(year%400)||(!(year%4)&&year%100)) M[2] = 29; + if (day > M[month]) { + day = 1; + month = parseInt(month)+1; + if (month > 12) { + year=parseInt(year)+1; month = 1; + } + } + month = month.toString(); + day = day.toString(); + if (month.length==1) month = "0"+month; + if (day.length==1) day = "0"+day; + } + hour = hour.toString(); + if (hour.length==1) hour="0"+hour; + return year+"-"+month+"-"+day+" "+hour+":"+minute; + } // Get group list $.ajax({ // Get current user type url: "/api/user/", diff --git a/template/src/oj/index.html b/template/src/oj/index.html index af54f1d..181fa31 100644 --- a/template/src/oj/index.html +++ b/template/src/oj/index.html @@ -8,71 +8,65 @@ @@ -103,20 +97,7 @@ 提交   比赛   小组   - 关于   - + 关于 @@ -124,9 +105,9 @@
-

青岛大学在线评测平台

+

青岛大学 Online Judge

-

全新面貌,新的开始~

+

新的面貌,新的开始~

↓继续滚动~
@@ -156,7 +137,7 @@
-

自由举办小组赛

+

自由举办小组赛(10月上线)

内部比赛,日常作业,期末考试,通通搞定