Bladeren bron

Add homepage template with links to two endpoints; fix missing
ResultException import.

Stefano Cossu 7 jaren geleden
bovenliggende
commit
73211cf26c
3 gewijzigde bestanden met toevoegingen van 19 en 2 verwijderingen
  1. 1 0
      lakesuperior/ldp/ldpr.py
  2. 2 2
      server.py
  3. 16 0
      templates/index.html

+ 1 - 0
lakesuperior/ldp/ldpr.py

@@ -10,6 +10,7 @@ import arrow
 from rdflib import Graph
 from rdflib.resource import Resource
 from rdflib.namespace import RDF, XSD
+from rdflib.query import ResultException
 from rdflib.term import Literal
 
 from lakesuperior.config_parser import config

+ 2 - 2
server.py

@@ -1,4 +1,4 @@
-from flask import Flask
+from flask import Flask, render_template
 
 from lakesuperior.config_parser import config
 from lakesuperior.endpoints.ldp import ldp
@@ -24,7 +24,7 @@ def index():
     '''
     Homepage.
     '''
-    return u'<h1>Hello. This is LAKEsuperior.</h1><p>Exciting, isn’t it?</p>'
+    return render_template('index.html')
 
 
 @fcrepo.route('/debug', methods=['GET'])

+ 16 - 0
templates/index.html

@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+    <head>
+            <title>LAKEsuperior :: Homepage</title>
+    </head>
+    <body>
+        <h1>LAKEsuperior</h1>
+        <p><em>That’s it?</em></p>
+        <p>Well, check out the shiny endpoints below here.</p>
+        <ul>
+            <li><a href='/ldp'>LDP REST endpoint</a></li>
+            <li><a href='/query'>Query endpoint</a></li>
+        </ul>
+    </body>
+</html>
+