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 rm /etc/apache2/sites-enabled/000-default.conf
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql libapache2-mod-wsgi-py3
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql libapache2-mod-wsgi-py3
|
||||||
# make for testing
|
# 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 ln -s /data/dev/apache-local.conf /etc/apache2/sites-enabled/
|
||||||
#RUN a2enmod rewrite
|
#RUN a2enmod rewrite
|
||||||
|
|
|
@ -123,12 +123,11 @@ def slide(request, cid, seid, slid):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
print(user_solution, file=sys.stderr)
|
#print(user_solution, file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
result = request
|
result = request
|
||||||
print(result, file=sys.stderr)
|
#print(result, file=sys.stderr)
|
||||||
print(dir(result), file=sys.stderr)
|
#print(dir(result), file=sys.stderr)
|
||||||
|
|
||||||
# determine next slide, as necessary for the navigation
|
# determine next slide, as necessary for the navigation
|
||||||
next_slide = {'course': course, 'section': None, 'slide': None}
|
next_slide = {'course': course, 'section': None, 'slide': None}
|
||||||
|
|
|
@ -75,9 +75,42 @@
|
||||||
</p>
|
</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,17 +122,17 @@
|
||||||
<li>Created by <b><a href="">Lloyd Humphreys</a></b>:
|
<li>Created by <b><a href="">Lloyd Humphreys</a></b>:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/uploads/?i=96763">Computer</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/uploads/?i=96763">Computer</a></li>
|
||||||
<!-- <a href="https://thenounproject.com/Lloyd/collection/circuitry/">Cirtuity</a> -->
|
<!-- <a href="https://thenounproject.com/Lloyd/collection/circuitry/">Cirtuity</a> -->
|
||||||
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96125">Light Emitting Diode</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96125">Light Emitting Diode</a></li>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96166">Dual Gate Transistor</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96166">Dual Gate Transistor</a></li>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?q=Inductor&i=96121">Inductor Bifflar</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?q=Inductor&i=96121">Inductor Bifflar</a></li>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96143">Resistor</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?i=96143">Resistor</a></li>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/uploads/?i=96678">Processor</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/uploads/?i=96678">Processor</a></li>
|
||||||
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?q=Inductor&i=96121">Heavy Rain</a></li>
|
<li><a href="https://thenounproject.com/Lloyd/collection/circuitry/?q=Inductor&i=96121">Heavy Rain</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>Created by <b><a href="https://thenounproject.com/alessandrantonetti/">alessandra antonetti</a></b>:
|
<li>Created by <b><a href="https://thenounproject.com/alessandrantonetti/">alessandra antonetti</a></b>:
|
||||||
<ul>
|
<ul>
|
||||||
<!-- https://thenounproject.com/ArtZ91/collection/blocks/ -->
|
<!-- https://thenounproject.com/ArtZ91/collection/blocks/ -->
|
||||||
<li><a href="https://thenounproject.com/search/?q=algorithm&creator=15311&i=204142">Cycle</a></li>
|
<li><a href="https://thenounproject.com/search/?q=algorithm&creator=15311&i=204142">Cycle</a></li>
|
||||||
|
@ -108,14 +141,14 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>Created by <b><a href="https://thenounproject.com/ArtZ91/">Arthur Shlain</a></b>:
|
<li>Created by <b><a href="https://thenounproject.com/ArtZ91/">Arthur Shlain</a></b>:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://thenounproject.com/alessandrantonetti/uploads/?i=31678">Circuit</a></li>
|
<li><a href="https://thenounproject.com/alessandrantonetti/uploads/?i=31678">Circuit</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<li>Created by <b><a href="https://thenounproject.com/creativestall/">Creative Stall</a></b>:
|
<li>Created by <b><a href="https://thenounproject.com/creativestall/">Creative Stall</a></b>:
|
||||||
<ul>
|
<ul>
|
||||||
<!--<li><a href="https://thenounproject.com/creativestall/collection/data-storage-server-and-transfer-material-icons/"></a></li> -->
|
<!--<li><a href="https://thenounproject.com/creativestall/collection/data-storage-server-and-transfer-material-icons/"></a></li> -->
|
||||||
<li><a href="https://thenounproject.com/search/?q=server&creator=638256&i=177061">Server</a></li>
|
<li><a href="https://thenounproject.com/search/?q=server&creator=638256&i=177061">Server</a></li>
|
||||||
|
@ -130,7 +163,7 @@
|
||||||
|
|
||||||
|
|
||||||
<h2>Software</h2>
|
<h2>Software</h2>
|
||||||
|
|
||||||
<p>Several open source software projects enable the platform to operate. This section is dedicated to acknowledge the most important.</p>
|
<p>Several open source software projects enable the platform to operate. This section is dedicated to acknowledge the most important.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -141,13 +174,13 @@
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#hoou {
|
#hoou {
|
||||||
width: 175px;
|
width: 175px;
|
||||||
height: 42px;
|
height: 42px;
|
||||||
background: url('{% static 'misc' %}/hover-hoou.png') no-repeat left top;
|
background: url('{% static 'misc' %}/hover-hoou.png') no-repeat left top;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
|
@ -159,7 +192,7 @@
|
||||||
|
|
||||||
|
|
||||||
#uhh {
|
#uhh {
|
||||||
width: 155px;
|
width: 155px;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
background: url('{% static 'misc' %}/hover-uhh.png') no-repeat left top;
|
background: url('{% static 'misc' %}/hover-uhh.png') no-repeat left top;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
|
@ -172,7 +205,7 @@
|
||||||
|
|
||||||
|
|
||||||
#dkrz {
|
#dkrz {
|
||||||
width: 147px;
|
width: 147px;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
background: url('{% static 'misc' %}/hover-dkrz.png') no-repeat left top;
|
background: url('{% static 'misc' %}/hover-dkrz.png') no-repeat left top;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
|
@ -199,7 +232,7 @@
|
||||||
<img src="{% static 'misc' %}/logo-uhh.png" style="height: 60px;"/>
|
<img src="{% static 'misc' %}/logo-uhh.png" style="height: 60px;"/>
|
||||||
-->
|
-->
|
||||||
<!-- <p>© University of Hamburg</p> -->
|
<!-- <p>© University of Hamburg</p> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,9 @@
|
||||||
.sep { color: silver; margin: 0.3em; }
|
.sep { color: silver; margin: 0.3em; }
|
||||||
</style>
|
</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>
|
<span class="sep">|</span>
|
||||||
<a href="https://wr.informatik.uni-hamburg.de/impressum">Impressum</a>
|
<a href="https://hps.vi4io.org/research/projects/hamburg/icp">Contact</a>
|
||||||
<span class="sep">|</span>
|
|
||||||
<a href="https://wr.informatik.uni-hamburg.de/research/projects/icp">Contact</a>
|
|
||||||
<span class="sep">|</span>
|
<span class="sep">|</span>
|
||||||
<a href="/attribution">Attribution</a>
|
<a href="/attribution">Attribution</a>
|
||||||
</footer>
|
</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 id="element" style="background-image: url({% static 'frontend/drawing_nocredit.png' %}); background-size: 62.5% auto; background-repeat: repeat-x;"> </div>
|
||||||
</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">
|
<div class="container">
|
||||||
<!-- Example row of columns -->
|
<!-- Example row of columns -->
|
||||||
<div class="row">
|
<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>
|
<p><a class="btn btn-default" href="{% url 'courses:course' course.id %}" role="button">Take course »</a></p>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% 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>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
<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" %}
|
{% include "frontend/footer.html" %}
|
||||||
|
|
||||||
</div> <!-- /container -->
|
</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/jquery.min.js' %}"></script>
|
||||||
<script src="{% static 'lib/bootstrap/js/bootstrap.min.js' %}"></script>
|
<script src="{% static 'lib/bootstrap/js/bootstrap.min.js' %}"></script>
|
||||||
|
|
||||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
<!-- 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 'lib/bootstrap/assets/js/ie10-viewport-bug-workaround.js' %}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="{% static 'cookielaw/js/cookielaw.js' %}"></script>
|
<script src="{% static 'cookielaw/js/cookielaw.js' %}"></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -10,9 +10,8 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="/">
|
<a class="navbar-brand" href="/">
|
||||||
<b style="color: white;">Teaching</b> at
|
<b style="color: white;">Teaching</b> at
|
||||||
<span style="color: white;">Scientific Computing</span> /
|
<img src="https://hps.vi4io.org/_media/logo.png" style="height:1em; float:right; margin-left: 5px"/>
|
||||||
<small style="font-size: 0.8em;">University of Hamburg</small>
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +54,7 @@
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<li><a href="{% url 'social:begin' 'github' %}?next={{ request.path }}"><i class="fa fa-github"></i> Login with GitHub</a>
|
<li><a href="{% url 'social:begin' 'github' %}?next={{ request.path }}"><i class="fa fa-github"></i> Login with GitHub</a>
|
||||||
<li><a href="{% url 'social:begin' 'reddit' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Reddit</a>
|
<li><a href="{% url 'social:begin' 'reddit' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Reddit</a>
|
||||||
<li><a href="{% url 'social:begin' 'twitter' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Twitter</a>
|
<li><a href="{% url 'social:begin' 'twitter' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Twitter</a>
|
||||||
|
@ -66,18 +65,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<!--<form class="navbar-form navbar-right">
|
|
||||||
<input type="text" class="form-control" placeholder="Search...">
|
|
||||||
</form> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ INSTALLED_APPS = (
|
||||||
'main',
|
'main',
|
||||||
'courses',
|
'courses',
|
||||||
'frontend',
|
'frontend',
|
||||||
#'rest',
|
'rest',
|
||||||
'generated_exercises', #TODO FIXME
|
'generated_exercises', #TODO FIXME
|
||||||
'tools'
|
'tools'
|
||||||
)
|
)
|
||||||
|
|
|
@ -41,7 +41,7 @@ urlpatterns = [
|
||||||
#url(r'^dashboard/', include('dashboard.urls')), # stats etc? -> index?
|
#url(r'^dashboard/', include('dashboard.urls')), # stats etc? -> index?
|
||||||
|
|
||||||
# APIs
|
# APIs
|
||||||
# url(r'^api/rest/', include('rest.urls', namespace='rest')),
|
url(r'^api/rest/', include('rest.urls', namespace='rest')),
|
||||||
|
|
||||||
# Admin (also course managment?)
|
# Admin (also course managment?)
|
||||||
#url(r'^admin/', include(admin.site.urls)),
|
#url(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
|
@ -2,6 +2,8 @@ from django.conf.urls import url
|
||||||
|
|
||||||
from rest import views
|
from rest import views
|
||||||
|
|
||||||
|
app_name="rest"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', views.index, name='index'),
|
url(r'^$', views.index, name='index'),
|
||||||
|
|
||||||
|
@ -12,7 +14,7 @@ urlpatterns = [
|
||||||
|
|
||||||
# the event stream is only receiving events
|
# the event stream is only receiving events
|
||||||
url(r'^event$', views.event, name='event'),
|
url(r'^event$', views.event, name='event'),
|
||||||
|
|
||||||
# adding jobs yields a jobID which can be used to query the state
|
# adding jobs yields a jobID which can be used to query the state
|
||||||
url(r'^job/new/$', views.job_new, name='job_new'),
|
url(r'^job/new/$', views.job_new, name='job_new'),
|
||||||
url(r'^job/(?P<jid>.*?)/$', views.job_status, name='job_status'),
|
url(r'^job/(?P<jid>.*?)/$', views.job_status, name='job_status'),
|
||||||
|
|
|
@ -14,8 +14,8 @@ from rest_framework.response import Response
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
# mongo
|
# mongo
|
||||||
import pymongo
|
#import pymongo
|
||||||
from pymongo import MongoClient
|
#from pymongo import MongoClient
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from bson import json_util
|
from bson import json_util
|
||||||
|
@ -34,6 +34,15 @@ from courses.models import Slide
|
||||||
from courses.models import UserCourse
|
from courses.models import UserCourse
|
||||||
from courses.models import UserSolution
|
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
|
# helpers
|
||||||
class JSONResponse(HttpResponse):
|
class JSONResponse(HttpResponse):
|
||||||
"""
|
"""
|
||||||
|
@ -119,25 +128,26 @@ def entry_list(request, database_id):
|
||||||
@api_view(['POST'])
|
@api_view(['POST'])
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def event(request):
|
def event(request):
|
||||||
event_db = mongo["events"]
|
#event_db = mongo["events"]
|
||||||
event_col = event_db["events"]
|
#event_col = event_db["events"]
|
||||||
|
return JSONResponse({"details": "OK"}, status=201)
|
||||||
|
|
||||||
if request.method == 'POST':
|
#if request.method == 'POST':
|
||||||
|
|
||||||
# populate additional fields
|
# # populate additional fields
|
||||||
request.data["timestamp"] = datetime.datetime.now()
|
# request.data["timestamp"] = datetime.datetime.now()
|
||||||
request.data["referrer"] = request.META.get('HTTP_REFERER') # sic
|
# request.data["referrer"] = request.META.get('HTTP_REFERER') # sic
|
||||||
request.data["user_id"] = request.user.id
|
# request.data["user_id"] = request.user.id
|
||||||
#print(request.data, file=sys.stderr)
|
# #print(request.data, file=sys.stderr)
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
_id = event_col.insert(request.data)
|
# _id = event_col.insert(request.data)
|
||||||
print(request.data['type'], _id, file=sys.stderr)
|
# print(request.data['type'], _id, file=sys.stderr)
|
||||||
#json_docs = json.dumps(data, default=json_util.default)
|
# #json_docs = json.dumps(data, default=json_util.default)
|
||||||
return JSONResponse({"details": "OK", "id": str(_id)}, status=201)
|
# return JSONResponse({"details": "OK", "id": str(_id)}, status=201)
|
||||||
|
|
||||||
except:
|
# except:
|
||||||
return JSONResponse({"details": "insert failed."}, status=400)
|
# return JSONResponse({"details": "insert failed."}, status=400)
|
||||||
#else:
|
#else:
|
||||||
# return JSONResponse("""{"error": "HTTP request type not allowed."}""", status=400)
|
# return JSONResponse("""{"error": "HTTP request type not allowed."}""", status=400)
|
||||||
|
|
||||||
|
@ -149,7 +159,7 @@ def event(request):
|
||||||
#@api_view(['GET','POST'])
|
#@api_view(['GET','POST'])
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def job_status(request, jid):
|
def job_status(request, jid):
|
||||||
print("Job-status " + jid)
|
#print("Job-status " + jid)
|
||||||
data = str({"field1": "value1"})
|
data = str({"field1": "value1"})
|
||||||
|
|
||||||
#job_db = mongo["jobs"]
|
#job_db = mongo["jobs"]
|
||||||
|
@ -158,11 +168,11 @@ def job_status(request, jid):
|
||||||
#return HttpResponse(status=404)
|
#return HttpResponse(status=404)
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
|
#task = celery_task_compile_and_run.AsyncResult(jid)
|
||||||
task = celery_task_compile_and_run.AsyncResult(jid)
|
task = local_execute_result(jid)
|
||||||
print("results")
|
#print("results")
|
||||||
data = {"status": task.status, "data": task.result}
|
data = {"status": task["status"], "data": task["result"]}
|
||||||
print("DONE!")
|
#print("DONE!")
|
||||||
|
|
||||||
#json_docs = json.dumps(data, default=json_util.default)
|
#json_docs = json.dumps(data, default=json_util.default)
|
||||||
#data = JSONParser().parse(json_docs)
|
#data = JSONParser().parse(json_docs)
|
||||||
|
@ -175,10 +185,8 @@ def job_status(request, jid):
|
||||||
@api_view(['POST'])
|
@api_view(['POST'])
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def job_new(request):
|
def job_new(request):
|
||||||
job_db = mongo["jobs"]
|
#job_db = mongo["jobs"]
|
||||||
job_col = job_db["jobs"]
|
#job_col = job_db["jobs"]
|
||||||
|
|
||||||
|
|
||||||
# Snipped in-case we would like to force the referrer to match the slide.
|
# Snipped in-case we would like to force the referrer to match the slide.
|
||||||
#slid = None
|
#slid = None
|
||||||
#referrer = request.META.get('HTTP_REFERER')
|
#referrer = request.META.get('HTTP_REFERER')
|
||||||
|
@ -192,14 +200,12 @@ def job_new(request):
|
||||||
#
|
#
|
||||||
#print(slid, file=sys.stderr)
|
#print(slid, file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
print(datetime.datetime.now(), file=sys.stderr)
|
#print(datetime.datetime.now(), file=sys.stderr)
|
||||||
print(request.data, file=sys.stderr)
|
#print(request.data, file=sys.stderr)
|
||||||
|
|
||||||
slide = get_object_or_404(Slide, pk=request.data['slide'])
|
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 = {}
|
||||||
#job_dic['timestamp'] = datetime.datetime.now()
|
#job_dic['timestamp'] = datetime.datetime.now()
|
||||||
|
@ -209,8 +215,7 @@ def job_new(request):
|
||||||
job_dic['type'] = slide.slide_type
|
job_dic['type'] = slide.slide_type
|
||||||
job_dic['data'] = json.loads(slide.data)
|
job_dic['data'] = json.loads(slide.data)
|
||||||
job_dic['user_id'] = request.user.id
|
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.
|
# Also create/update the user solution.
|
||||||
user_solution = None
|
user_solution = None
|
||||||
|
@ -221,31 +226,31 @@ def job_new(request):
|
||||||
except UserSolution.DoesNotExist:
|
except UserSolution.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
print(user_solution, file=sys.stderr)
|
#print(user_solution, file=sys.stderr)
|
||||||
|
|
||||||
if user_solution != None:
|
if user_solution != None:
|
||||||
user_solution.data = json.dumps(request.data)
|
user_solution.data = json.dumps(request.data)
|
||||||
user_solution.save()
|
user_solution.save()
|
||||||
|
|
||||||
|
#pprint.pprint(job_dic, sys.stderr)
|
||||||
pprint.pprint(job_dic, sys.stderr)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task = celery_task_compile_and_run.delay(job_dic)
|
#task = celery_task_compile_and_run.delay(job_dic)
|
||||||
print(dir(task), file=sys.stderr)
|
task = local_execute(job_dic)
|
||||||
print("PREP")
|
|
||||||
|
|
||||||
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)
|
#print(task.status, file=sys.stderr)
|
||||||
job_dic["_id"] = task.id
|
job_dic["_id"] = task["id"]
|
||||||
print("DONE")
|
#print("DONE")
|
||||||
|
|
||||||
#_id = job_col.insert(request.data)
|
#_id = job_col.insert(request.data)
|
||||||
#print(_id, file=sys.stderr)
|
#print(_id, file=sys.stderr)
|
||||||
#json_docs = json.dumps(data, default=json_util.default)
|
#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:
|
except:
|
||||||
|
print(sys.exc_info()[0])
|
||||||
return JSONResponse({"details": "Job submission failed."}, status=400)
|
return JSONResponse({"details": "Job submission failed."}, status=400)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue