Commits

Miki Tebeka  committed d2a701e

template

  • Participants
  • Parent commits 5dcd5e2
  • Branches template

Comments (0)

Files changed (3)

     - url: /.*
       script: shortie.app
 
+libraries:
+    - name: jinja2
+      version: latest
+<html>
+    <head>
+        <title>Shortie - The URL Shortener</title>
+    </head>
+    <body>
+        <h2>Shortie - The URL Shortener</h2>
+        <form method="post">
+            <label for="url">Url:</label><input name="url" /> 
+            <input type="submit" value="Shorten">
+        </form>
+    </body>
+</html>
+
 '''
 from google.appengine.ext import webapp
 
+import jinja2
+
+from os.path import dirname
+
+# Load templates from application directory
+get_template = jinja2.Environment(
+    loader=jinja2.FileSystemLoader(dirname(__file__))).get_template
+
 class Home(webapp.RequestHandler):
     def get(self):
-        self.response.out.write('Hello AppEngine')
+        template = get_template('index.html')
+        self.response.out.write(template.render())
 
 app = webapp.WSGIApplication([
     ('/', Home),