summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-11-09 17:26:46 +0530
committerGitHub2017-11-09 17:26:46 +0530
commitcfcb2ed39c724639fe17338e29e327d08ae641b2 (patch)
tree17bca625745b11d6152d9db1e9ebb49646d27d04 /yaksh
parente65b605e59c1384ad9607c99484107929248f220 (diff)
parent91de91014b24412f9ec5fe246235c38a00a778ec (diff)
downloadonline_test-cfcb2ed39c724639fe17338e29e327d08ae641b2.tar.gz
online_test-cfcb2ed39c724639fe17338e29e327d08ae641b2.tar.bz2
online_test-cfcb2ed39c724639fe17338e29e327d08ae641b2.zip
Merge pull request #379 from ankitjavalkar/better-installer-single-mount
Installation and Quickstart script using PyInvoke
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py4
-rw-r--r--yaksh/scripts/yaksh_script.sh11
-rw-r--r--yaksh/test_views.py4
3 files changed, 16 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index cb9b481..d698232 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -82,6 +82,8 @@ test_status = (
('completed', 'Completed'),
)
+FIXTURES_DIR_PATH = os.path.join(settings.BASE_DIR, 'yaksh', 'fixtures')
+
def get_assignment_dir(instance, filename):
upload_dir = instance.question_paper.quiz.description.replace(" ", "_")
@@ -544,7 +546,7 @@ class Question(models.Model):
def create_demo_questions(self, user):
zip_file_path = os.path.join(
- settings.FIXTURE_DIRS, 'demo_questions.zip'
+ FIXTURES_DIR_PATH, 'demo_questions.zip'
)
files, extract_path = extract_files(zip_file_path)
self.read_yaml(extract_path, user, files)
diff --git a/yaksh/scripts/yaksh_script.sh b/yaksh/scripts/yaksh_script.sh
new file mode 100644
index 0000000..f39153e
--- /dev/null
+++ b/yaksh/scripts/yaksh_script.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Basic script to install pip packages and run the yaksh code server command
+
+chown -R nobody output
+chmod -R a+rwX output
+chmod -R a+rX data yaksh
+chmod -R o-w data yaksh
+echo "** Installing python dependencies **"
+pip3 install -r ./requirements-codeserver.txt
+echo "** Running code server **"
+/usr/bin/sudo -su nobody python3 -m yaksh.code_server
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index e3b0168..652f44c 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -23,7 +23,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\
QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\
AssignmentUpload, FileUpload, McqTestCase, IntegerTestCase, StringTestCase,\
- FloatTestCase
+ FloatTestCase, FIXTURES_DIR_PATH
from yaksh.decorators import user_has_profile
@@ -3201,7 +3201,7 @@ class TestShowQuestions(TestCase):
username=self.user.username,
password=self.user_plaintext_pass
)
- ques_file = os.path.join(settings.FIXTURE_DIRS, "demo_questions.zip")
+ ques_file = os.path.join(FIXTURES_DIR_PATH, "demo_questions.zip")
f = open(ques_file, 'rb')
questions_file = SimpleUploadedFile(ques_file, f.read(),
content_type="application/zip")