Skip to content

Commit

Permalink
Got initial layout of the site working.
Browse files Browse the repository at this point in the history
  • Loading branch information
adewale committed Nov 22, 2010
0 parents commit ea0001c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app.yaml
@@ -0,0 +1,13 @@
application: buzzsearchengine
version: production
runtime: python
api_version: 1

handlers:
- url: /css
static_dir: css
- url: /.*
script: main.py

builtins:
- appstats: on
16 changes: 16 additions & 0 deletions css/style.css
@@ -0,0 +1,16 @@
h1 {
font-family: 'IM Fell English SC', arial, serif;
/*
Clever CSS effect from: http://twitter.com/#!/mathowie/statuses/5387020843094016 */
-webkit-text-stroke: 1px #F9C22F;
font-size: 74px;
line-height: 48px;
padding-top: 20px;

/* Minimize space after logo */
margin-bottom: 10px;
}

.input {
width: 100px;
}
17 changes: 17 additions & 0 deletions index.html
@@ -0,0 +1,17 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href='http://fonts.googleapis.com/css?family=IM+Fell+English+SC&subset=latin' rel='stylesheet' type='text/css'>
<title>BuzzSearch</title></head>

<body>
<div align="center">
<h1>BuzzSearch</h1>

<form method="get" action="/search">
<input name="q" placeholder="Search Buzz" type="search" size="100" required autofocus>
<input class="input" type="submit" value="Search">
</form>
</div>
</body>
</html>
45 changes: 45 additions & 0 deletions main.py
@@ -0,0 +1,45 @@
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util

import logging
import os

class MainPageHandler(webapp.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, {}, debug=True))


class SearchHandler(webapp.RequestHandler):
def get(self):
query = self.request.get("q")
results = []
template_values = {'q':query, 'results':results}

path = os.path.join(os.path.dirname(__file__), 'results.html')
self.response.out.write(template.render(path, template_values, debug=True))

application = webapp.WSGIApplication([('/', MainPageHandler), ('/search', SearchHandler)], debug = True
)


def main():
util.run_wsgi_app(application)

if __name__ == '__main__':
main()
23 changes: 23 additions & 0 deletions results.html
@@ -0,0 +1,23 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href='http://fonts.googleapis.com/css?family=IM+Fell+English+SC&subset=latin' rel='stylesheet' type='text/css'>
<title>BuzzSearch</title></head>

<body>
<div align="center">
<h1>BuzzSearch</h1>

<form method="get" action="/search">
<input name="q" placeholder="Search Buzz" type="search" size="100" value="{{ q }}" required>
<input class="input" type="submit" value="Search">
</form>
</div>

<div>
{% for result in results %}

{% endfor %}
</div>
</body>
</html>

0 comments on commit ea0001c

Please sign in to comment.