diff --git a/account/serializers.py b/account/serializers.py index fe54862f..e14ab8e1 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -86,7 +86,7 @@ class UserProfileSerializer(serializers.ModelSerializer): class EditUserSerializer(serializers.Serializer): id = serializers.IntegerField() username = serializers.CharField(max_length=32) - real_name = serializers.CharField(max_length=32, allow_blank=True) + real_name = serializers.CharField(max_length=32, allow_blank=True, allow_null=True) password = serializers.CharField(min_length=6, allow_blank=True, required=False, default=None) email = serializers.EmailField(max_length=64) admin_type = serializers.ChoiceField(choices=(AdminType.REGULAR_USER, AdminType.ADMIN, AdminType.SUPER_ADMIN)) diff --git a/docs/data.json b/docs/data.json index addb2fe6..415fa28c 100644 --- a/docs/data.json +++ b/docs/data.json @@ -1,14 +1,15 @@ { "update": [ { - "version": "2017-12-25", + "version": "2017-01-04", "level": "Recommend", - "title": "Update at 2017-12-25", + "title": "Update at 2018-01-04", "details": [ "Fix some issues under IE/Edge", "Add backend error reporter", "New email template", "A more flexible throttling function", + "Add admin dashboard (this page)", "Other bugs and enhancements" ] } diff --git a/oj/settings.py b/oj/settings.py index 2cb64ad2..055c0558 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -12,14 +12,15 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ import os import raven from copy import deepcopy +from utils.shortcuts import get_env +from .custom_settings import * -if os.environ.get("OJ_ENV") == "production": +production_env = get_env("OJ_ENV", "dev") == "production" +if production_env: from .production_settings import * else: from .dev_settings import * -from .custom_settings import * - BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Applications @@ -128,7 +129,7 @@ UPLOAD_DIR = f"{DATA_DIR}{UPLOAD_PREFIX}" STATICFILES_DIRS = [os.path.join(DATA_DIR, "public")] -LOGGING_HANDLERS = ['console'] if DEBUG else ['console', 'sentry'] +LOGGING_HANDLERS = ['console', 'sentry'] if production_env else ['console'] LOGGING = { 'version': 1, 'disable_existing_loggers': False, @@ -204,13 +205,6 @@ BROKER_URL = f"{REDIS_URL}/3" CELERY_TASK_SOFT_TIME_LIMIT = CELERY_TASK_TIME_LIMIT = 180 CELERY_ACCEPT_CONTENT = ["json"] CELERY_TASK_SERIALIZER = "json" - -# 用于限制用户恶意提交大量代码 -TOKEN_BUCKET_DEFAULT_CAPACITY = 10 - -# 单位:每分钟 -TOKEN_BUCKET_FILL_RATE = 2 - RAVEN_CONFIG = { 'dsn': 'https://b200023b8aed4d708fb593c5e0a6ad3d:1fddaba168f84fcf97e0d549faaeaff0@sentry.io/263057' } \ No newline at end of file