mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-29 16:41:56 +00:00
修改配置文件方便区分不同的开发环境
This commit is contained in:
parent
7febab2f1a
commit
c648e0008f
1
.gitignore
vendored
1
.gitignore
vendored
@ -63,3 +63,4 @@ build.txt
|
||||
tmp/
|
||||
test_case/
|
||||
release/
|
||||
upload/
|
@ -1,6 +1,6 @@
|
||||
FROM python:2.7
|
||||
ENV PYTHONBUFFERED 1
|
||||
RUN mkdir -p /code/log /code/test_case
|
||||
RUN mkdir -p /code/log /code/test_case /code/upload
|
||||
WORKDIR /code
|
||||
ADD requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
|
@ -1,4 +1,5 @@
|
||||
# coding=utf-8
|
||||
import os
|
||||
# 单个判题端最多同时运行的程序个数,因为判题端会同时运行多组测试数据,比如一共有5组测试数据
|
||||
# 如果MAX_RUNNING_NUMBER大于等于5,那么这5组数据就会同时进行评测,然后返回结果。
|
||||
# 如果MAX_RUNNING_NUMBER小于5,为3,那么就会同时运行前三组测试数据,然后再运行后两组数据
|
||||
@ -14,12 +15,10 @@ lrun_gid = 1002
|
||||
# judger工作目录
|
||||
judger_workspace = "/var/judger/"
|
||||
|
||||
|
||||
# 这个是在docker 中访问数据库 ip 不一定和web服务器还有celery的一样
|
||||
submission_db = {
|
||||
"host": "192.168.42.1",
|
||||
"host": os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"),
|
||||
"port": 3306,
|
||||
"db": "oj_submission",
|
||||
"user": "root",
|
||||
"password": "mypwd"
|
||||
"password": os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root")
|
||||
}
|
||||
|
@ -3,10 +3,6 @@ import os
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# 下面是需要自己修改的
|
||||
LOG_PATH = "log/"
|
||||
|
||||
# 注意这是web 服务器访问的地址,判题端访问的地址不一定一样,因为可能不在一台机器上
|
||||
DATABASES = {
|
||||
'default': {
|
||||
@ -17,11 +13,11 @@ DATABASES = {
|
||||
'submission': {
|
||||
'NAME': 'oj_submission',
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': "121.42.32.129",
|
||||
'CONN_MAX_AGE': 0.1,
|
||||
'HOST': "127.0.0.1",
|
||||
'PORT': 3306,
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'mypwd',
|
||||
'CONN_MAX_AGE': 0.1,
|
||||
'PASSWORD': 'root',
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,13 +29,11 @@ REDIS_CACHE = {
|
||||
|
||||
DEBUG = True
|
||||
|
||||
# 同理 这是 web 服务器的上传路径
|
||||
TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/')
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'static/src/upload_image/')
|
||||
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/src/")]
|
||||
# 在 debug 关闭的情况下,静态文件不是有 django runserver 来处理的,应该由 nginx 返回
|
||||
# 在 debug 开启的情况下,django 会在下面两个文件夹中寻找对应的静态文件。
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/src/"), BASE_DIR]
|
||||
|
||||
# 模板文件夹
|
||||
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/src/')]
|
@ -3,47 +3,41 @@ import os
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# 下面是需要自己修改的
|
||||
LOG_PATH = "/var/log/oj/"
|
||||
|
||||
# 注意这是web 服务器访问的地址,判题端访问的地址不一定一样,因为可能不在一台机器上
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': "oj",
|
||||
'CONN_MAX_AGE': 0.1,
|
||||
'HOST': '127.0.0.1',
|
||||
'HOST': os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"),
|
||||
'PORT': 3306,
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'mypwd'
|
||||
'PASSWORD': os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root")
|
||||
},
|
||||
'submission': {
|
||||
'NAME': 'oj_submission',
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'CONN_MAX_AGE': 0.1,
|
||||
'HOST': "127.0.0.1",
|
||||
'HOST': os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"),
|
||||
'PORT': 3306,
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'mypwd'
|
||||
'PASSWORD': os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root")
|
||||
}
|
||||
}
|
||||
|
||||
REDIS_CACHE = {
|
||||
"host": "127.0.0.1",
|
||||
"host": os.environ.get("REDIS_PORT_6379_TCP_ADDR", "127.0.0.1"),
|
||||
"port": 6379,
|
||||
"db": 1
|
||||
}
|
||||
|
||||
DEBUG = True
|
||||
|
||||
# 同理 这是 web 服务器的上传路径
|
||||
TEST_CASE_DIR = '/root/test_case/'
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
IMAGE_UPLOAD_DIR = '/var/mnt/source/OnlineJudge/static/src/upload_image/'
|
||||
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/")]
|
||||
# 在 debug 关闭的情况下,静态文件不是有 django runserver 来处理的,应该由 nginx 返回
|
||||
# 在 debug 开启的情况下,django 会在下面两个文件夹中寻找对应的静态文件。
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/"), os.path.join(BASE_DIR, "static/release/")]
|
||||
|
||||
# 模板文件夹
|
||||
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')]
|
||||
|
@ -89,7 +89,6 @@ TEMPLATES = [
|
||||
|
||||
WSGI_APPLICATION = 'oj.wsgi.application'
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
||||
|
||||
@ -111,6 +110,9 @@ STATIC_URL = '/static/'
|
||||
|
||||
AUTH_USER_MODEL = 'account.User'
|
||||
|
||||
LOG_PATH = "log/"
|
||||
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': True,
|
||||
@ -163,3 +165,7 @@ REST_FRAMEWORK = {
|
||||
}
|
||||
|
||||
DATABASE_ROUTERS = ['oj.db_router.DBRouter']
|
||||
|
||||
TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/')
|
||||
|
||||
IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'upload/')
|
@ -26,8 +26,8 @@ class SimditorImageUploadAPIView(APIView):
|
||||
return Response(data={
|
||||
"success": True,
|
||||
"msg": "上传错误",
|
||||
"file_path": "/static/upload_image/" + image_name})
|
||||
"file_path": "/static/upload/" + image_name})
|
||||
return Response(data={
|
||||
"success": True,
|
||||
"msg": "",
|
||||
"file_path": "/static/upload_image/" + image_name})
|
||||
"file_path": "/static/upload/" + image_name})
|
||||
|
Loading…
Reference in New Issue
Block a user