summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorankitjavalkar2017-11-15 16:50:24 +0530
committerankitjavalkar2018-01-04 11:37:20 +0530
commitc883413f4e7ef4642f9d18a0d383612f6abd9391 (patch)
tree7029aadd60d8fa6aa14b4c4bd20efd7bbdafe244 /yaksh/models.py
parentfeb295b4107a95621e9430f5c7042cfde4674cc0 (diff)
downloadonline_test-c883413f4e7ef4642f9d18a0d383612f6abd9391.tar.gz
online_test-c883413f4e7ef4642f9d18a0d383612f6abd9391.tar.bz2
online_test-c883413f4e7ef4642f9d18a0d383612f6abd9391.zip
- Add python-decouple package to requirements
- Use sane defaults and python-decouple in yaksh.settings module - Replace hard coded localhost domain name referring to code server with dynamic settings variable
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 1d24bda..bc0b4f1 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -29,10 +29,10 @@ import tempfile
from textwrap import dedent
from ast import literal_eval
from .file_utils import extract_files, delete_files
-from yaksh.code_server import(submit,
- get_result as get_result_from_code_server
- )
-from yaksh.settings import SERVER_POOL_PORT
+from yaksh.code_server import (
+ submit, get_result as get_result_from_code_server
+)
+from yaksh.settings import SERVER_POOL_PORT, SERVER_HOST_NAME
from django.conf import settings
from django.forms.models import model_to_dict
@@ -1705,7 +1705,7 @@ class AnswerPaper(models.Model):
elif question.type == 'code' or question.type == "upload":
user_dir = self.user.profile.get_user_dir()
- url = 'http://localhost:%s' % server_port
+ url = '{0}:{1}'.format(SERVER_HOST_NAME, SERVER_POOL_PORT)
submit(url, uid, json_data, user_dir)
result = {'uid': uid, 'status': 'running'}
return result