Permalink
Browse files

Added caching

  • Loading branch information...
pelle committed Jun 9, 2008
1 parent 7561c96 commit 6211e4d855574846f0edd0270ee4c10881b5ffdc
View
@@ -19,11 +19,15 @@ handlers:
static_files: static/\1/\2
upload: static/(javascripts|stylesheets|images)/(.*\.(js|css|png|gif|jpg))
-# Default static content url catches those w/o versions in their names.
+# Top level icons
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
+- url: /apple-touch-icon.png
+ static_files: static/apple-touch-icon.png
+ upload: static/apple-touch-icon.png
+
# Pass everything else to the django bootstrapper.
- url: /.*
script: django_bootstrap.py
View
@@ -22,11 +22,11 @@
def index(request):
"""Request / -- show all posts."""
user = users.GetCurrentUser()
-# posts = memcache.get("latest_posts")
-# if posts is None:
- posts = db.GqlQuery("SELECT * FROM Post ORDER BY created DESC LIMIT 20").fetch(20)
-# logging.info("setting memcache latest_posts")
-# memcache.set("latest_posts",posts)
+ posts = memcache.get("latest_posts")
+ if posts is None:
+ posts = db.GqlQuery("SELECT * FROM Post ORDER BY created DESC LIMIT 20").fetch(20)
+ logging.info("setting memcache latest_posts")
+ memcache.set("latest_posts",posts)
form = PostForm(None)
return views.respond(request, user, 'posts/index',
{'posts': posts, 'form' : form})
@@ -69,8 +69,8 @@ def create(request):
post.put()
profile.increase_count()
-# memcache.delete("latest_posts")
-# memcache.delete("posts_from_%s"%profile.nick)
+ memcache.delete("latest_posts")
+ memcache.delete("posts_from_%s"%profile.nick)
logging.info('Saved the post, %s' % post)
return http.HttpResponseRedirect('/')
View
@@ -42,13 +42,13 @@ def show(request, nick):
post=None
form = PostForm(post)
-# posts = memcache.get("posts_from_%s"%nick)
-# if posts is None:
- posts=profile.post_set
- posts.order("-created")
- posts=posts.fetch(20)
-# logging.info("setting memcache posts_from_%s"%nick)
-# memcache.set("posts_from_%s"%nick,posts)
+ posts = memcache.get("posts_from_%s"%nick)
+ if posts is None:
+ posts=profile.post_set
+ posts.order("-created")
+ posts=posts.fetch(20)
+ logging.info("setting memcache posts_from_%s"%nick)
+ memcache.set("posts_from_%s"%nick,posts)
return views.respond(request, user, 'profiles/show',
{'posts': posts, 'profile' : profile,'form':form})
View
@@ -10,14 +10,14 @@ indexes:
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.
-# Used 9 times in query history.
+# Used 13 times in query history.
- kind: Post
properties:
- name: author
- name: created
direction: desc
-# Used 195 times in query history.
+# Used 227 times in query history.
- kind: Post
properties:
- name: created
@@ -6,6 +6,6 @@
@register.filter
#@stringfilter
def atify(value):
- m=re.compile('(@(\w+))')
+ m=re.compile('(@([\w\.-]+))')
return m.sub(r'<a href="/profiles/\2" class="profile" rel="friend">\1</a>',value)
atify.is_safe = True
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -23,18 +23,20 @@ a { outline: none; }
/* Base Layout */
#page {
- margin-left:150px;
+ margin:0 auto;
padding: 1em;
width:800px;
+ position: relative;
background: white;
}
#logo {
position:absolute;
- top:3.5em;
- left:850px;
+ top: 1.5em;
+ right:0;
}
#header {
margin-bottom:1em;
+ font-size: 1.2em;
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -8,10 +8,11 @@
<link rel="stylesheet" href="/stylesheets/talk_compiled.{{ CURRENT_VERSION_ID }}.css" type="text/css" media="screen" charset="utf-8"/>
{% endifequal %}
<!--[if lte IE 6]><link rel="stylesheet" href="/stylesheets/lib/ie.css" type="text/css" media="screen" charset="utf-8"><![endif]-->
+ <meta name="viewport" content="width = 800" />
</head>
<body>
- <div id="logo"><a href="/"><img src="/images/logo.png"></a></div>
<div id="page">
+ <div id="logo"><a href="/"><img src="/images/logo.png"></a></div>
<div id="header">
<ul class="tabs">
{%if user %}

0 comments on commit 6211e4d

Please sign in to comment.