Skip to content

Commit

Permalink
Python 2.7 and FOR LEASE sign
Browse files Browse the repository at this point in the history
  • Loading branch information
dustball committed Apr 24, 2013
1 parent 70ef84b commit ec926b8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 20 deletions.
5 changes: 3 additions & 2 deletions app.yaml
@@ -1,6 +1,7 @@
application: hd-website
version: 2
runtime: python
runtime: python27
threadsafe: true
api_version: 1

handlers:
Expand All @@ -14,4 +15,4 @@ handlers:
static_dir: static
expiration: "1d"
- url: .*
script: main.py
script: main.app
26 changes: 9 additions & 17 deletions main.py
Expand Up @@ -3,12 +3,8 @@
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from google.appengine.dist import use_library
use_library('django', '1.2')

import pytz
from datetime import datetime
from django.utils import simplejson
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.ext import webapp
Expand All @@ -17,6 +13,7 @@
import pprint
import urllib
import re
import json

PB_WIKI = 'dojowebsite'
PB_API_URL = 'http://%s.pbworks.com/api_v2/op/GetPage/page/%s'
Expand All @@ -37,11 +34,11 @@ def _request(url, cache_ttl=3600, force=False):
try:
data = urlfetch.fetch(url)
if 'pbworks.com' in url:
resp = simplejson.loads(data.content[11:-3])
resp = json.loads(data.content[11:-3])
if "html" in resp:
resp["html"] = re.sub("/w/page/\d*", "", resp["html"])
else:
resp = simplejson.loads(data.content)
resp = json.loads(data.content)
memcache.set(request_cache_key, resp, cache_ttl)
memcache.set(failure_cache_key, resp, cache_ttl*10)
except (ValueError, urlfetch.DownloadError), e:
Expand Down Expand Up @@ -118,14 +115,9 @@ def get(self, pagename, site = PB_WIKI):
self.error(404)


def main():
application = webapp.WSGIApplication([
('/api/pbwebhook', PBWebHookHandler),
('/api/event_staff', StaffHandler),
('/', IndexHandler),
('/(.+)', MainHandler)],
debug=True)
util.run_wsgi_app(application)

if __name__ == '__main__':
main()
app = webapp.WSGIApplication([
('/api/pbwebhook', PBWebHookHandler),
('/api/event_staff', StaffHandler),
('/', IndexHandler),
('/(.+)', MainHandler)],
debug=True)
Binary file modified pytz/__init__.pyc
Binary file not shown.
Binary file modified pytz/tzfile.pyc
Binary file not shown.
Binary file modified pytz/tzinfo.pyc
Binary file not shown.
Binary file added static/images/forelease1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/forelease2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion templates/index.html
Expand Up @@ -16,7 +16,8 @@
{% block content %}

<section class="hero-image" >
<a href="/ANewHomeForHackerDojo" style="position:absolute; right:-105px; top:-50px; z-index:200"><img width="281" height="279" alt="Help save the Dojo! Donate now" src="{{cdn}}/static/images/omgmoved.png" border="0"></a>
<a href="/SpacesForLease" style="position:absolute; right:-105px; top:0px; z-index:200"><img width="297" height="228" alt="Spaces for Lease" src="{{cdn}}/static/images/forelease1.png" onmouseover="this.src='{{cdn}}/static/images/forelease2.png';" onmouseout="this.src='{{cdn}}/static/images/forelease1.png';" border="0"></a>

<div id="mycarousel" style="overflow:hidden">
<ul style="overflow:none">
<li>
Expand Down Expand Up @@ -116,3 +117,4 @@ <h3>Visit Us</h3>
</article>

{% endblock %}

0 comments on commit ec926b8

Please sign in to comment.