Anpassungen für Reading
This commit is contained in:
parent
ebe78713ef
commit
90d8c13215
|
@ -6,7 +6,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y apache2
|
|||
RUN rm /etc/apache2/sites-enabled/000-default.conf
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql libapache2-mod-wsgi-py3
|
||||
# make for testing
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y virtualenv make sudo
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y virtualenv make sudo gcc
|
||||
|
||||
RUN ln -s /data/dev/apache-local.conf /etc/apache2/sites-enabled/
|
||||
#RUN a2enmod rewrite
|
||||
|
|
|
@ -123,12 +123,11 @@ def slide(request, cid, seid, slid):
|
|||
pass
|
||||
|
||||
|
||||
print(user_solution, file=sys.stderr)
|
||||
|
||||
#print(user_solution, file=sys.stderr)
|
||||
|
||||
result = request
|
||||
print(result, file=sys.stderr)
|
||||
print(dir(result), file=sys.stderr)
|
||||
#print(result, file=sys.stderr)
|
||||
#print(dir(result), file=sys.stderr)
|
||||
|
||||
# determine next slide, as necessary for the navigation
|
||||
next_slide = {'course': course, 'section': None, 'slide': None}
|
||||
|
|
|
@ -75,9 +75,42 @@
|
|||
</p>
|
||||
|
||||
|
||||
<h2>Platform</h2>
|
||||
|
||||
<p>
|
||||
The platform was initially created as a funded project of the Hamburg Open Online University.
|
||||
<div style="text-align: ;">
|
||||
<a id="hoou" href="http://www.hoou.de/"></a><a id="uhh" href="http://www.uni-hamburg.de"></a>
|
||||
</div>
|
||||
Please see the project details <a href="https://hps.vi4io.org/research/projects/hamburg/icp">here</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
#hoou {
|
||||
width: 175px;
|
||||
height: 42px;
|
||||
background: url('{% static 'misc' %}/hover-hoou.png') no-repeat left top;
|
||||
background-size: 100% auto;
|
||||
|
||||
display: inline-block;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#hoou:hover { background-position: 0px 100% }
|
||||
|
||||
|
||||
#uhh {
|
||||
width: 155px;
|
||||
height: 52px;
|
||||
background: url('{% static 'misc' %}/hover-uhh.png') no-repeat left top;
|
||||
background-size: 100% auto;
|
||||
|
||||
display: inline-block;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#uhh:hover { background-position: 0px 100% }
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,11 +14,9 @@
|
|||
.sep { color: silver; margin: 0.3em; }
|
||||
</style>
|
||||
|
||||
<a href="https://redmine.wr.informatik.uni-hamburg.de/projects/icp">Platform</a>
|
||||
<a href="https://hps.vi4io.org/impressum">Impressum</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="https://wr.informatik.uni-hamburg.de/impressum">Impressum</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="https://wr.informatik.uni-hamburg.de/research/projects/icp">Contact</a>
|
||||
<a href="https://hps.vi4io.org/research/projects/hamburg/icp">Contact</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="/attribution">Attribution</a>
|
||||
</footer>
|
||||
|
|
|
@ -44,19 +44,6 @@
|
|||
<div id="element" style="background-image: url({% static 'frontend/drawing_nocredit.png' %}); background-size: 62.5% auto; background-repeat: repeat-x;"> </div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<!--
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1>Welcome.</h1>
|
||||
<p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
|
||||
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more »</a></p>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="container">
|
||||
<!-- Example row of columns -->
|
||||
<div class="row">
|
||||
|
@ -68,130 +55,19 @@
|
|||
<p><a class="btn btn-default" href="{% url 'courses:course' course.id %}" role="button">Take course »</a></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<!--
|
||||
<div class="col-md-4 course-listing">
|
||||
<h2>C Primer</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4 course-listing">
|
||||
<h2>High Performance Computing</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4 course-listing">
|
||||
<h2>Big Data Analytics</h2>
|
||||
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
|
||||
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 course-listing">
|
||||
<h2>High Performance I/O</h2>
|
||||
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
|
||||
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 course-listing">
|
||||
<h2>Linux Kernel Programming</h2>
|
||||
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
|
||||
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
#hoou {
|
||||
width: 175px;
|
||||
height: 42px;
|
||||
background: url('{% static 'misc' %}/hover-hoou.png') no-repeat left top;
|
||||
background-size: 100% auto;
|
||||
|
||||
display: inline-block;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#hoou:hover { background-position: 0px 100% }
|
||||
|
||||
|
||||
#uhh {
|
||||
width: 155px;
|
||||
height: 52px;
|
||||
background: url('{% static 'misc' %}/hover-uhh.png') no-repeat left top;
|
||||
background-size: 100% auto;
|
||||
|
||||
display: inline-block;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#uhh:hover { background-position: 0px 100% }
|
||||
|
||||
|
||||
|
||||
#dkrz {
|
||||
width: 147px;
|
||||
height: 52px;
|
||||
background: url('{% static 'misc' %}/hover-dkrz.png') no-repeat left top;
|
||||
background-size: 100% auto;
|
||||
|
||||
display: inline-block;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#dkrz:hover { background-position: 0px 100% }
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div style="text-align: ;">
|
||||
<a id="hoou" href="http://www.hoou.de/"></a><a id="uhh" href="http://www.uni-hamburg.de"></a><a id="dkrz" href="http://www.dkrz.de"></a>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
<img src="{% static 'misc' %}/logo-hoou.png" style="height: 50px;"/>
|
||||
<span style="margin-left: 1em;"> </span>
|
||||
<img src="{% static 'misc' %}/logo-uhh.png" style="height: 60px;"/>
|
||||
-->
|
||||
<!-- <p>© University of Hamburg</p> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% include "frontend/footer.html" %}
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="{% static 'lib/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'lib/bootstrap/js/bootstrap.min.js' %}"></script>
|
||||
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<script src="{% static 'lib/bootstrap/assets/js/ie10-viewport-bug-workaround.js' %}"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="{% static 'cookielaw/js/cookielaw.js' %}"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
</button>
|
||||
<a class="navbar-brand" href="/">
|
||||
<b style="color: white;">Teaching</b> at
|
||||
<span style="color: white;">Scientific Computing</span> /
|
||||
<small style="font-size: 0.8em;">University of Hamburg</small>
|
||||
<img src="https://hps.vi4io.org/_media/logo.png" style="height:1em; float:right; margin-left: 5px"/>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
@ -66,18 +65,10 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
</ul>
|
||||
<!--<form class="navbar-form navbar-right">
|
||||
<input type="text" class="form-control" placeholder="Search...">
|
||||
</form> -->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ INSTALLED_APPS = (
|
|||
'main',
|
||||
'courses',
|
||||
'frontend',
|
||||
#'rest',
|
||||
'rest',
|
||||
'generated_exercises', #TODO FIXME
|
||||
'tools'
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ urlpatterns = [
|
|||
#url(r'^dashboard/', include('dashboard.urls')), # stats etc? -> index?
|
||||
|
||||
# APIs
|
||||
# url(r'^api/rest/', include('rest.urls', namespace='rest')),
|
||||
url(r'^api/rest/', include('rest.urls', namespace='rest')),
|
||||
|
||||
# Admin (also course managment?)
|
||||
#url(r'^admin/', include(admin.site.urls)),
|
||||
|
|
|
@ -2,6 +2,8 @@ from django.conf.urls import url
|
|||
|
||||
from rest import views
|
||||
|
||||
app_name="rest"
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index, name='index'),
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ from rest_framework.response import Response
|
|||
from django.shortcuts import get_object_or_404
|
||||
|
||||
# mongo
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
#import pymongo
|
||||
#from pymongo import MongoClient
|
||||
|
||||
import json
|
||||
from bson import json_util
|
||||
|
@ -34,6 +34,15 @@ from courses.models import Slide
|
|||
from courses.models import UserCourse
|
||||
from courses.models import UserSolution
|
||||
|
||||
def local_execute(dic):
|
||||
print("LOCAL EXECUTE")
|
||||
print(dic)
|
||||
return {"id" : 100}
|
||||
|
||||
def local_execute_result(id):
|
||||
print("Retrieving: " + id)
|
||||
return {"status" : 201, "result": {"output" : False, "grade" : "PASS"}}
|
||||
|
||||
# helpers
|
||||
class JSONResponse(HttpResponse):
|
||||
"""
|
||||
|
@ -119,25 +128,26 @@ def entry_list(request, database_id):
|
|||
@api_view(['POST'])
|
||||
@csrf_exempt
|
||||
def event(request):
|
||||
event_db = mongo["events"]
|
||||
event_col = event_db["events"]
|
||||
#event_db = mongo["events"]
|
||||
#event_col = event_db["events"]
|
||||
return JSONResponse({"details": "OK"}, status=201)
|
||||
|
||||
if request.method == 'POST':
|
||||
#if request.method == 'POST':
|
||||
|
||||
# populate additional fields
|
||||
request.data["timestamp"] = datetime.datetime.now()
|
||||
request.data["referrer"] = request.META.get('HTTP_REFERER') # sic
|
||||
request.data["user_id"] = request.user.id
|
||||
#print(request.data, file=sys.stderr)
|
||||
# # populate additional fields
|
||||
# request.data["timestamp"] = datetime.datetime.now()
|
||||
# request.data["referrer"] = request.META.get('HTTP_REFERER') # sic
|
||||
# request.data["user_id"] = request.user.id
|
||||
# #print(request.data, file=sys.stderr)
|
||||
|
||||
try:
|
||||
_id = event_col.insert(request.data)
|
||||
print(request.data['type'], _id, file=sys.stderr)
|
||||
#json_docs = json.dumps(data, default=json_util.default)
|
||||
return JSONResponse({"details": "OK", "id": str(_id)}, status=201)
|
||||
# try:
|
||||
# _id = event_col.insert(request.data)
|
||||
# print(request.data['type'], _id, file=sys.stderr)
|
||||
# #json_docs = json.dumps(data, default=json_util.default)
|
||||
# return JSONResponse({"details": "OK", "id": str(_id)}, status=201)
|
||||
|
||||
except:
|
||||
return JSONResponse({"details": "insert failed."}, status=400)
|
||||
# except:
|
||||
# return JSONResponse({"details": "insert failed."}, status=400)
|
||||
#else:
|
||||
# return JSONResponse("""{"error": "HTTP request type not allowed."}""", status=400)
|
||||
|
||||
|
@ -149,7 +159,7 @@ def event(request):
|
|||
#@api_view(['GET','POST'])
|
||||
@csrf_exempt
|
||||
def job_status(request, jid):
|
||||
print("Job-status " + jid)
|
||||
#print("Job-status " + jid)
|
||||
data = str({"field1": "value1"})
|
||||
|
||||
#job_db = mongo["jobs"]
|
||||
|
@ -158,11 +168,11 @@ def job_status(request, jid):
|
|||
#return HttpResponse(status=404)
|
||||
|
||||
if request.method == 'GET':
|
||||
|
||||
task = celery_task_compile_and_run.AsyncResult(jid)
|
||||
print("results")
|
||||
data = {"status": task.status, "data": task.result}
|
||||
print("DONE!")
|
||||
#task = celery_task_compile_and_run.AsyncResult(jid)
|
||||
task = local_execute_result(jid)
|
||||
#print("results")
|
||||
data = {"status": task["status"], "data": task["result"]}
|
||||
#print("DONE!")
|
||||
|
||||
#json_docs = json.dumps(data, default=json_util.default)
|
||||
#data = JSONParser().parse(json_docs)
|
||||
|
@ -175,10 +185,8 @@ def job_status(request, jid):
|
|||
@api_view(['POST'])
|
||||
@csrf_exempt
|
||||
def job_new(request):
|
||||
job_db = mongo["jobs"]
|
||||
job_col = job_db["jobs"]
|
||||
|
||||
|
||||
#job_db = mongo["jobs"]
|
||||
#job_col = job_db["jobs"]
|
||||
# Snipped in-case we would like to force the referrer to match the slide.
|
||||
#slid = None
|
||||
#referrer = request.META.get('HTTP_REFERER')
|
||||
|
@ -192,14 +200,12 @@ def job_new(request):
|
|||
#
|
||||
#print(slid, file=sys.stderr)
|
||||
|
||||
|
||||
|
||||
if request.method == 'POST':
|
||||
print(datetime.datetime.now(), file=sys.stderr)
|
||||
print(request.data, file=sys.stderr)
|
||||
#print(datetime.datetime.now(), file=sys.stderr)
|
||||
#print(request.data, file=sys.stderr)
|
||||
|
||||
slide = get_object_or_404(Slide, pk=request.data['slide'])
|
||||
print("Solution from: ", slide.title, file=sys.stderr)
|
||||
#print("Solution from: ", slide.title, file=sys.stderr)
|
||||
|
||||
job_dic = {}
|
||||
#job_dic['timestamp'] = datetime.datetime.now()
|
||||
|
@ -209,8 +215,7 @@ def job_new(request):
|
|||
job_dic['type'] = slide.slide_type
|
||||
job_dic['data'] = json.loads(slide.data)
|
||||
job_dic['user_id'] = request.user.id
|
||||
print('job_dic:', file=sys.stderr)
|
||||
|
||||
#print('job_dic:', file=sys.stderr)
|
||||
|
||||
# Also create/update the user solution.
|
||||
user_solution = None
|
||||
|
@ -221,31 +226,31 @@ def job_new(request):
|
|||
except UserSolution.DoesNotExist:
|
||||
pass
|
||||
|
||||
print(user_solution, file=sys.stderr)
|
||||
#print(user_solution, file=sys.stderr)
|
||||
|
||||
if user_solution != None:
|
||||
user_solution.data = json.dumps(request.data)
|
||||
user_solution.save()
|
||||
|
||||
|
||||
pprint.pprint(job_dic, sys.stderr)
|
||||
#pprint.pprint(job_dic, sys.stderr)
|
||||
|
||||
try:
|
||||
task = celery_task_compile_and_run.delay(job_dic)
|
||||
print(dir(task), file=sys.stderr)
|
||||
print("PREP")
|
||||
#task = celery_task_compile_and_run.delay(job_dic)
|
||||
task = local_execute(job_dic)
|
||||
|
||||
print(task.id, file=sys.stderr)
|
||||
#print(dir(task), file=sys.stderr)
|
||||
#print("PREP")
|
||||
#print(task.id, file=sys.stderr)
|
||||
#print(task.status, file=sys.stderr)
|
||||
job_dic["_id"] = task.id
|
||||
print("DONE")
|
||||
job_dic["_id"] = task["id"]
|
||||
#print("DONE")
|
||||
|
||||
#_id = job_col.insert(request.data)
|
||||
#print(_id, file=sys.stderr)
|
||||
#json_docs = json.dumps(data, default=json_util.default)
|
||||
return JSONResponse({"details": "OK", "id": str(task.id)}, status=201)
|
||||
|
||||
return JSONResponse({"details": "OK", "id": str(task["id"])}, status=201)
|
||||
except:
|
||||
print(sys.exc_info()[0])
|
||||
return JSONResponse({"details": "Job submission failed."}, status=400)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue