mirror of
https://github.com/QingdaoU/OpenVJ.git
synced 2024-12-28 15:31:48 +00:00
完善设置
This commit is contained in:
parent
e05c5a284e
commit
1e3a185c1f
@ -1,7 +0,0 @@
|
||||
FROM python:3.5
|
||||
ENV PYTHONBUFFERED 1
|
||||
RUN mkdir -p /code /code/log
|
||||
COPY requirements.txt /tmp
|
||||
RUN pip install -i http://pypi.douban.com/simple -r /tmp/requirements.txt --trusted-host pypi.douban.com
|
||||
WORKDIR /code
|
||||
CMD bash /code/dockerfiles/robot/run.sh
|
@ -1,5 +0,0 @@
|
||||
robot:
|
||||
image: robot
|
||||
environment:
|
||||
- REDIS_PORT_6379_TCP_ADDR=
|
||||
- REDIS_PASSWORD=
|
@ -1,6 +0,0 @@
|
||||
django
|
||||
mysqlclient
|
||||
celery
|
||||
requests
|
||||
djangorestframework
|
||||
redis
|
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
celery -A robot.tasks worker -l DEBUG
|
@ -7,5 +7,5 @@ find /code -name "*.pyc" -delete
|
||||
python -m compileall /code
|
||||
chown -R nobody:nogroup /code/log
|
||||
gunicorn openvj.wsgi:application -b 0.0.0.0:8080 --user nobody --group nogroup --reload &
|
||||
celery -A openvj worker -l DEBUG -Q local &
|
||||
celery -A openvj worker -l DEBUG -f /code/log/celery.log&
|
||||
wait
|
@ -13,6 +13,9 @@ from .tasks import get_problem, submit_dispatcher
|
||||
from .utils import success_response, error_response, serializer_invalid_response, import_class
|
||||
|
||||
|
||||
demo_key = "977c723a4f93ed311f052e6fad51728b"
|
||||
|
||||
|
||||
class ProblemAPIView(APIView):
|
||||
def get(self, request):
|
||||
oj = request.GET.get("oj")
|
||||
@ -20,7 +23,7 @@ class ProblemAPIView(APIView):
|
||||
if not (oj and url):
|
||||
return error_response("参数错误")
|
||||
try:
|
||||
api_key = request.META.get("HTTP_APIKEY", "d4f82f56514165f9f82bc6d434f02615")
|
||||
api_key = APIKey.objects.get(api_key=request.META.get("HTTP_APIKEY", demo_key), is_valid=True)
|
||||
except APIKey.DoesNotExist:
|
||||
return error_response("需要api_key")
|
||||
try:
|
||||
@ -91,8 +94,7 @@ class SubmissionAPIView(APIView):
|
||||
return error_response("oj不存在")
|
||||
|
||||
try:
|
||||
api_key = request.META.get("HTTP_APIKEY", "d4f82f56514165f9f82bc6d434f02615")
|
||||
api_key = APIKey.objects.get(api_key=api_key, is_valid=True)
|
||||
api_key = APIKey.objects.get(api_key=request.META.get("HTTP_APIKEY", demo_key), is_valid=True)
|
||||
except APIKey.DoesNotExist:
|
||||
return error_response("需要api_key")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user