Skip to content

Commit

Permalink
updated to python27 runtime, django1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-nic committed Feb 25, 2013
1 parent 70e284f commit 03d1300
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 54 deletions.
23 changes: 16 additions & 7 deletions app.yaml
@@ -1,7 +1,16 @@
application: mediarcade
version: 1-2-test
runtime: python
application: thom-nichols
version: b
runtime: python27
api_version: 1
threadsafe: true

libraries:
- name: django
version: "1.2"
- name: webob
version: "1.1.1"
- name: pycrypto
version: 'latest'

handlers:
- url: /static
Expand All @@ -18,12 +27,12 @@ handlers:
static_files: static/robots.txt
upload: static/robots.txt

- url: /admin/shell.*
script: handlers/shell/shell.py
login: admin
#- url: /admin/shell.*
# script: handlers/shell/shell.py
# login: admin

- url: .*
script: main.py
script: main.application

skip_files: |
^(.*/)?(
Expand Down
44 changes: 26 additions & 18 deletions config.py
Expand Up @@ -12,6 +12,9 @@
# Bloog source code updates.
# Do change blog or page dictionaries at the bottom of this config module.

# This is used for django to find the custom templatetags:
INSTALLED_APPS = ('utils')

BLOG = {
"bloog_version": "0.8",
"html_type": "application/xhtml+xml",
Expand All @@ -22,7 +25,7 @@
# application due to mail api restrictions.
"email": "tmnichols@gmail.com",
"tagline": "Technology is evolution outside the gene pool",
"description": """I'm a Software Engineer living near Providence, RI.  
"description": """I'm a Software Engineer living near Providence, RI.
I code for work, freelance, and when an idea strikes me, sometimes
just for fun.""",
"root_url": "http://blog.thomnichols.org",
Expand Down Expand Up @@ -66,8 +69,10 @@
"legacy_entry_redirect": True,

"picasa_image_store": False, # if false, will use local datastore for uploaded images
"picasa_auth": { 'user':'CHANGEME',
"gdata": { 'user':'CHANGEME',
'password':'CHANGEME', # your google accounts password :(
'source' : 'tomstrummer-bloog-v0.8', #tells Google what app is using the service
#this must be an ID or 'default' (not album name); see dev/scripts/picasa_get_album_id.py
'album':'default' } #this must be 'default' or an ID (not name); see dev/scripts/picasa_get_album_id.py
}

Expand All @@ -77,7 +82,7 @@
"yui_version": '2.8.0r4',
"author_name": 'Thom',
"author_email": BLOG['email'],
"ga_tracker": "UA-10492632", # Google Analytics tracker code
"ga_tracker": "UA-10492632-1", # Google Analytics tracker code
"navlinks": [
{ "title": "Articles", "description": "Bits of Info",
"url": "/articles"},
Expand All @@ -88,33 +93,36 @@
"title": "About Me",
"description": BLOG['description'],
"entries": [
{ "title": "Portfolio",
"url": BLOG['root_url']+'/portfolio',
"description": "Work I've done" },
{ "title": "Profile",
"url": BLOG['root_url']+'/+',
"description": "on Google+" },
{ "title": "On Twitter",
"url": "http://twitter.com/tom_nichols",
"url": "http://twitter.com/thom_nic",
"description": "Twitter Feed" },
{ "title": "On GitHub",
"url": "http://github.com/tomstrummer",
"description": "Projects hosted on Github" },
{ "title": "HTTP Builder",
"url": "http://groovy.codehaus.org/modules/http-builder",
"description": "One of my more significant open-source projects" },
{ "title": "My Google Reader Feed",
"url": "https://www.google.com/reader/shared/00209487153858041827",
"description": "Interesting articles worth passing along" }
"description": "Projects on Github" }
]
},
"featuredOthersPages": {
"title": "Additional Links",
"description": "Miscellaneous Resources",
"entries": [
{ "title": "Google App Engine",
"url": "http://code.google.com/appengine/",
"description": "The mothership" },
{ "title": "Marco Polo",
"url": "http://marcopolo.thomnichols.org",
"description": "Explore your social network!" },
{ "title": "HTTP Builder",
"url": "http://groovy.codehaus.org/modules/http-builder",
"description": "HTTP/ REST client API for Groovy" },
{ "title": "Python Web Console",
"url": "http://pythonwebconsole.thomnichols.org",
"description": "Run Python from your browser" },
{ "title": "Bloog",
"url": "http://bloog.billkatz.com/",
"description": "Customize your own blog" },
{ "title": "Groovy",
"url": "http://groovy.codehaus.org",
"description": "Dynamic high-level language for the JVM" }
"description": "Customize your own blog" }
]
},
}
16 changes: 4 additions & 12 deletions main.py
Expand Up @@ -32,20 +32,15 @@
sys.path.insert(1, os.path.join(config.APP_ROOT_DIR, 'utils/external'))

os.environ['DJANGO_SETTINGS_MODULE'] = 'config'
from google.appengine.dist import use_library
use_library('django', '0.96')
from django.conf import settings
settings._setup() #needed to initialize template tags

import logging
#import wsgiref.handlers
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import webapp
from google.appengine.api import users
from handlers.bloog import blog, contact, cache_stats, timings, imagestore

# Import custom django libraries
webapp.template.register_template_library('utils.django_libs.gravatar')
webapp.template.register_template_library('utils.django_libs.description')

# Configure logging for debug if in dev environment
if config.DEBUG: logging.getLogger().setLevel(logging.DEBUG)

Expand Down Expand Up @@ -82,14 +77,11 @@ def get(self):
('/%2B$', ProfileHandler), # http://blog.thomnichols.org/+
('/(.*)', blog.ArticleHandler)]

application = webapp.WSGIApplication(ROUTES, debug=config.DEBUG)

def main():
path = timings.start_run()
application = webapp.WSGIApplication(ROUTES, debug=config.DEBUG)
# Attempt to fix KeyError: 'CONTENT_TYPE' that is appearing in logs; see:
# http://code.google.com/p/googleappengine/issues/detail?id=2040
#wsgiref.handlers.CGIHandler().run(application)
run_wsgi_app(application)
application.run()
timings.stop_run(path)

if __name__ == "__main__":
Expand Down
File renamed without changes.
Expand Up @@ -27,9 +27,9 @@

import re

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

register = webapp.template.create_template_register()
register = template.Library()

def description(value):
return re.sub(r'<[^>]*?>', '', value).replace("\n","")[0:150]
Expand Down
Expand Up @@ -27,9 +27,9 @@

import md5

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

register = webapp.template.create_template_register()
register = template.Library()

def gravatar(email):
return md5.new(email).hexdigest()
Expand Down
2 changes: 1 addition & 1 deletion views/default/bloog/base.html
Expand Up @@ -88,7 +88,7 @@ <h1><a href="/">{{ blog.title }}</a></h1>
{% block first_column %}
<div id="mainCol" class="fix"><a name="main"></a>
{% for article in articles %}
{% include 'article_excerpt.html' %}
{% include 'blog/article_excerpt.html' %}
{% endfor %}
{% if not articles %}
{% include 'bloog_intro.html' %}
Expand Down
9 changes: 6 additions & 3 deletions views/default/bloog/blog/article.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load description %}

{% block head %}
{% if article.embedded_code %}
Expand Down Expand Up @@ -30,8 +31,10 @@
<span class="date">{{ article.published.date }}</span>
</div>
<h2><a id="blogtitle" href="/{{ article.permalink }}" title="{{ article.title }}">{{ article.title }}</a></h2>
<div id="blogbody" class="entry">
{{ article.html }}
<div id="blogbody" class="entry">
{% autoescape off %}
{{ article.html }}
{% endautoescape %}
</div>
</div>
<div id="more_reading">
Expand Down Expand Up @@ -91,4 +94,4 @@ <h3><span id="num_comments">{{ article.num_comments }}</span> Comments</h3>
{% if not two_columns %}
{% include 'ads.html' %}
{% endif %}
{% endblock %}
{% endblock %}
Expand Up @@ -11,6 +11,8 @@ <h2><a href="/{{ article.permalink }}"
title="{{ article.title }}">{{ article.title }}</a></h2>

<div class="entry">
<p>{{ article.html|truncatewords_html:68 }}</p>
{% autoescape off %}
<p>{{ article.html|truncatewords_html:68 }}</p>
{% endautoescape %}
</div>
</div>
6 changes: 4 additions & 2 deletions views/default/bloog/blog/atom.xml
Expand Up @@ -37,7 +37,9 @@
{% else %}
<summary type="xhtml" xml:lang="en" xml:base="{{ blog.root_url }}">
<div xmlns="http://www.w3.org/1999/xhtml">
{{ article.to_atom_xml|truncatewords_html:88 }}
{% autoescape off %}
{{ article.to_atom_xml|truncatewords_html:88 }}
{% endautoescape %}
<p>
<a href="{{ article.full_permalink }}">Read more &#8230;</a>
&#160;&#160;|&#160;&#160;
Expand All @@ -53,4 +55,4 @@
</entry>
{% endfor %}

</feed>
</feed>
10 changes: 7 additions & 3 deletions views/default/bloog/blog/comment.html
@@ -1,8 +1,10 @@
{% load gravatar %}

<li id="comment-{{ comment.key }}" class="alt item indent{{ comment.get_indentation }}">
<div class="fix">
<p class="comment_meta">
{% if use_gravatars and comment.email %}
<img class="gravatar" src="http://www.gravatar.com/avatar/{{comment.email|gravatar}}?s=32&r=g&d=identicon" alt="avatar" />
<img class="gravatar" src="http://www.gravatar.com/avatar/{{comment.email|gravatar}}?s=32&r=g&d=retro" alt="avatar" />
{% endif %}
<span class="subject">{{ comment.title|default:"Re: Article" }}</span>

Expand All @@ -13,8 +15,10 @@
{{ comment.name|default:"Anonymous" }}
{% endif %}</span>
</p>
<div class="comment_text">
{{ comment.body }}
<div class="comment_text">
{% autoescape off %}
{{ comment.body }}
{% endautoescape %}
</div>
{% if allow_comments %}
<p class="post_meta">
Expand Down
2 changes: 1 addition & 1 deletion views/default/bloog/blog/month.html
Expand Up @@ -7,7 +7,7 @@
<h2>Articles from the month {{ month }}/{{ year }}</h2>
</div>
{% for article in articles %}
{% include '../article_excerpt.html' %}
{% include 'article_excerpt.html' %}
{% endfor %}
{% else %}
<div class="post">
Expand Down
2 changes: 1 addition & 1 deletion views/default/bloog/blog/search.html
Expand Up @@ -7,7 +7,7 @@
<h2>Articles found under '{{ search_term }}'</h2>
</div>
{% for article in articles %}
{% include '../article_excerpt.html' %}
{% include 'article_excerpt.html' %}
{% endfor %}
{% include 'pager.html' %}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion views/default/bloog/blog/tag.html
Expand Up @@ -11,7 +11,7 @@
<h2>Articles tagged with '{{ tag }}'</h2>
</div>
{% for article in articles %}
{% include '../article_excerpt.html' %}
{% include 'article_excerpt.html' %}
{% endfor %}
{% include 'pager.html' %}
{% else %}
Expand Down

0 comments on commit 03d1300

Please sign in to comment.