Commits

Justin Venezuela committed 3cfddf0

Using templates!

Comments (0)

Files changed (7)

 application: mit-starleague
-version: 1
+version: 2
 runtime: python
 api_version: 1
 
   upload: src/static/img
 
 - url: /.*
-  static_files: src/static/html/index.html
-  upload: src/static/html/
+  script: src/handlers.py
+import os
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import template
+from google.appengine.ext.webapp.util import run_wsgi_app
+
+def getTemplate(template_name, params={}):
+  templates_path = os.path.join(os.path.dirname(__file__), 'templates')
+  template_file = os.path.join(templates_path, template_name)
+  return template.render(template_file, params)
+
+class HomeHandler(webapp.RequestHandler):
+  def get(self):
+    return self.response.out.write(getTemplate('index.html'), )
+
+class SponsorshipHandler(webapp.RequestHandler):
+  def get(self):
+    return self.response.out.write(getTemplate('sponsorship.html'))
+
+application = webapp.WSGIApplication([
+  ('/', HomeHandler),
+  ('/sponsorship', SponsorshipHandler)
+], debug=True)
+
+def main():
+  run_wsgi_app(application)
+
+if __name__ == '__main__':
+  main()

src/static/css/starleague.css

   text-align:center;
   color:white
 }
+a:link,
+a:hover,
+a:visited,
+a:active{
+  color:white
+}
 
 /**
  * Defined classes.
 
 .column{
   width:600px;
-  margin:50px auto;
+  margin:40px auto;
 }
 .content{
-  padding:20px;
+  padding:15px;
   border-style:solid;
   border-color:black;
   border-width:5px;
   background-color:#8B7D6B
 }
+.small_link{
+  font-size:0.7em
+}
 .footer{
   font-size:0.8em
 }

src/static/img/background.png

Added
New image

src/templates/base.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
+<!--
+  - Author: Justin Venezuela (jven@mit.edu)
+  - Web site for MIT Starleague Invitational 2011.
+  -->
+
+<html>
+  <head>
+    <link href="/css/starleague.css" rel="stylesheet" type="text/css" />
+    <title>MIT Starleague</title>
+  </head>
+  <body>
+    <div class="column">
+      <div class="content">
+{% block content %}
+{% endblock %}
+      </div>
+      <div class="footer">
+        <p>Questions? Comments? E-mail starleague-officers (at) mit (dot) edu.</p>
+      </div>
+    </div>
+  </body>
+</html>

src/templates/index.html

+{% extends "base.html" %}
+{% block content %}
+<div id="tourney_info">
+  <p>
+    <img src="/img/protoss.png" />
+    <img src="/img/terran.png" />
+    <img src="/img/zerg.png" />
+  </p>
+  <p class="heading">MIT Starleague Invitationals 2011</p>
+  </table>
+  <p>When: Saturday, October 29, 2011</p>
+  <p>Where: ???</p>
+</div>
+<hr>
+<div id="sponsor_info">
+  <p class="heading">Sponsors</p>
+  <p>
+    <a href="http://justin.tv/" target="_blank"><img src="/img/justintv.png" /></a>
+  </p>
+  <p class="small_link"><a href="/sponsorship">Interested in sponsoring?</a></p>
+</div>
+{% endblock %}

src/templates/sponsorship.html

+{% extends "base.html" %}
+{% block content %}
+<div id="about_us">
+  <p>We're so awesome!</p>
+  <p class="small_link"><a href="/">Back</a></p>
+</div>
+{% endblock %}