diff options
author | ttt | 2017-05-13 00:29:47 +0530 |
---|---|---|
committer | ttt | 2017-05-13 00:29:47 +0530 |
commit | 4336f5f06f61de30ae3fa54650fce63a9d5ef5be (patch) | |
tree | 23b4ee9b8e8f24bf732acf2f7ad22ed50cdd5670 /sbhs_server/pages | |
download | SBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.tar.gz SBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.tar.bz2 SBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.zip |
added all server files
Diffstat (limited to 'sbhs_server/pages')
-rw-r--r-- | sbhs_server/pages/__init__.py | 0 | ||||
-rw-r--r-- | sbhs_server/pages/__init__.pyc | bin | 0 -> 144 bytes | |||
-rw-r--r-- | sbhs_server/pages/admin.py | 3 | ||||
-rw-r--r-- | sbhs_server/pages/management/__init__.py | 0 | ||||
-rw-r--r-- | sbhs_server/pages/management/__init__.pyc | bin | 0 -> 155 bytes | |||
-rw-r--r-- | sbhs_server/pages/management/commands/__init__.py | 0 | ||||
-rw-r--r-- | sbhs_server/pages/management/commands/arm.diff | 14 | ||||
-rw-r--r-- | sbhs_server/pages/management/commands/zip_client.py | 66 | ||||
-rw-r--r-- | sbhs_server/pages/models.py | 3 | ||||
-rw-r--r-- | sbhs_server/pages/models.pyc | bin | 0 -> 198 bytes | |||
-rw-r--r-- | sbhs_server/pages/tests.py | 3 | ||||
-rw-r--r-- | sbhs_server/pages/views.py | 41 |
12 files changed, 130 insertions, 0 deletions
diff --git a/sbhs_server/pages/__init__.py b/sbhs_server/pages/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sbhs_server/pages/__init__.py diff --git a/sbhs_server/pages/__init__.pyc b/sbhs_server/pages/__init__.pyc Binary files differnew file mode 100644 index 0000000..f37f24c --- /dev/null +++ b/sbhs_server/pages/__init__.pyc diff --git a/sbhs_server/pages/admin.py b/sbhs_server/pages/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/sbhs_server/pages/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/sbhs_server/pages/management/__init__.py b/sbhs_server/pages/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sbhs_server/pages/management/__init__.py diff --git a/sbhs_server/pages/management/__init__.pyc b/sbhs_server/pages/management/__init__.pyc Binary files differnew file mode 100644 index 0000000..d400ccc --- /dev/null +++ b/sbhs_server/pages/management/__init__.pyc diff --git a/sbhs_server/pages/management/commands/__init__.py b/sbhs_server/pages/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sbhs_server/pages/management/commands/__init__.py diff --git a/sbhs_server/pages/management/commands/arm.diff b/sbhs_server/pages/management/commands/arm.diff new file mode 100644 index 0000000..868bec1 --- /dev/null +++ b/sbhs_server/pages/management/commands/arm.diff @@ -0,0 +1,14 @@ +--- a/sbhs_server/pages/management/commands/zip_client.py ++++ b/sbhs_server/pages/management/commands/zip_client.py +@@ -33,6 +33,10 @@ class Command(BaseCommand): + run_file_dirpath = os.path.join(dirpath, "run_file") + + os.mkdir(tmp_dirpath) ++ for root, dirs, files in os.walk(dirpath): ++ for f in files: ++ shutil.copy(os.path.join(dirpath, f), os.path.join(tmp_dirpath, f)) ++ + distutils.dir_util.copy_tree(scilab_codes_dirpath, tmp_dirpath) + try: + shutil.rmtree(tmp_dirpath + "/" + scilab_codes_dirname + "/.git") + diff --git a/sbhs_server/pages/management/commands/zip_client.py b/sbhs_server/pages/management/commands/zip_client.py new file mode 100644 index 0000000..89263bf --- /dev/null +++ b/sbhs_server/pages/management/commands/zip_client.py @@ -0,0 +1,66 @@ +from django.core.management.base import BaseCommand +import os, zipfile, shutil, distutils.core +from sbhs_server import settings + +class Command(BaseCommand): + args = '' + help = 'ZIP all clients for all architectures.' + + def handle(self, *args, **options): + def zipdir(path, zip, rootname): + for root, dirs, files in os.walk(path): + for file in files: + pathname = os.path.join(root, file) + zip.write(pathname, rootname + "/" + pathname.replace(path, "")) + + scilab_codes_dirname = "scilab_codes" + scilab_codes_dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, scilab_codes_dirname) + zipped_dirname = "zipped" + zipped_dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, zipped_dirname) + + dirs = os.listdir(settings.SBHSCLIENT_STATIC_DIR) + print dirs + dirs.remove(scilab_codes_dirname) + dirs.remove(zipped_dirname) + print dirs + dirs = [d for d in dirs if os.path.isdir(os.path.join(settings.SBHSCLIENT_STATIC_DIR, d))] + print dirs + dirs = [d for d in dirs if not d.startswith(".")] + + for dirname in dirs: + print dirname + dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, dirname) + tmp_dirpath = os.path.join(zipped_dirpath, dirname) + common_files_dirpath = os.path.join(dirpath, "common_files") + run_file_dirpath = os.path.join(dirpath, "run_file") + + os.mkdir(tmp_dirpath) + for f in os.listdir(dirpath): + if os.path.isfile(os.path.join(dirpath, f)): + shutil.copy(os.path.join(dirpath, f), os.path.join(tmp_dirpath, f)) + + if dirname not in ["analysis", "local"]: + distutils.dir_util.copy_tree(scilab_codes_dirpath, tmp_dirpath) + else: + distutils.dir_util.copy_tree(dirpath, tmp_dirpath) + try: + shutil.rmtree(tmp_dirpath + "/" + scilab_codes_dirname + "/.git") + except: + pass + + try: + for root, dirs, files in os.walk(tmp_dirpath): + if os.path.exists(os.path.join(root, "scilabread.sce")): + distutils.dir_util.copy_tree(run_file_dirpath, root) + except: + pass + + try: + distutils.dir_util.copy_tree(common_files_dirpath, os.path.join(tmp_dirpath, "common_files")) + except: + pass + + zipf = zipfile.ZipFile(os.path.join(zipped_dirpath, "sbhsclient/scilab_codes_" + dirname + ".zip"), 'w', zipfile.ZIP_DEFLATED) + zipdir(tmp_dirpath, zipf, "scilab_codes_" + dirname) + zipf.close() + shutil.rmtree(tmp_dirpath) diff --git a/sbhs_server/pages/models.py b/sbhs_server/pages/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/sbhs_server/pages/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/sbhs_server/pages/models.pyc b/sbhs_server/pages/models.pyc Binary files differnew file mode 100644 index 0000000..470724c --- /dev/null +++ b/sbhs_server/pages/models.pyc diff --git a/sbhs_server/pages/tests.py b/sbhs_server/pages/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/sbhs_server/pages/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/sbhs_server/pages/views.py b/sbhs_server/pages/views.py new file mode 100644 index 0000000..4b88086 --- /dev/null +++ b/sbhs_server/pages/views.py @@ -0,0 +1,41 @@ +from django.shortcuts import render +from django.template.loader import render_to_string +from django.http import HttpResponseNotFound, HttpResponseServerError + +# Create your views here. + +def index(req): + return render(req, "pages/index.html") + +def about(req): + return render(req, "pages/about.html") + +def contact(req): + return render(req, "pages/contact.html") + +def info(req): + return render(req, "pages/info.html") + +def downloads(req): + return render(req, "pages/downloads.html") + +def theory(req): + return render(req, "pages/theory.html") + +def procedure(req): + return render(req, "pages/procedure.html") + +def experiments(req): + return render(req, "pages/experiments.html") + +def feedback(req): + return render(req, "pages/feedback.html") + +def quiz(req): + return render(req, "pages/quiz.html") + +def e404(req): + return HttpResponseNotFound(render_to_string('pages/e404.html')) + +def e500(req): + return HttpResponseServerError(render_to_string('pages/e500.html')) |