diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index a4d9e78..a001ffd 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -35,7 +35,7 @@ except ImportError: from io import BytesIO as string_io import re # Local imports. -from yaksh.code_server import get_result as get_result_from_code_server, SERVER_POOL_PORT +from yaksh.code_server import get_result as get_result_from_code_server, from yaksh.models import ( Answer, AnswerPaper, AssignmentUpload, Course, FileUpload, FloatTestCase, HookTestCase, IntegerTestCase, McqTestCase, Profile, @@ -51,6 +51,7 @@ from yaksh.forms import ( UploadFileForm, get_object_form, FileForm, QuestionPaperForm, LessonForm, LessonFileForm, LearningModuleForm, ExerciseForm ) +from yaksh.settings import SERVER_POOL_PORT, SERVER_HOST_NAME from .settings import URL_ROOT from .file_utils import extract_files, is_csv from .send_emails import send_user_mail, generate_activation_key, send_bulk_mail @@ -782,7 +783,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None, ) if current_question.type in ['code', 'upload']: if paper.time_left() <= 0 and not paper.question_paper.quiz.is_exercise: - url = 'http://localhost:%s' % SERVER_POOL_PORT + url = '{0}:{1}'.format(SERVER_HOST_NAME, SERVER_POOL_PORT) result_details = get_result_from_code_server(url, uid, block=True) result = json.loads(result_details.get('result')) next_question, error_message, paper = _update_paper(request, uid, @@ -807,7 +808,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None, @csrf_exempt def get_result(request, uid, course_id, module_id): result = {} - url = 'http://localhost:%s' % SERVER_POOL_PORT + url = '{0}:{1}'.format(SERVER_HOST_NAME, SERVER_POOL_PORT) result_state = get_result_from_code_server(url, uid) result['status'] = result_state.get('status') if result['status'] == 'done': |