折腾完GAE上Micolog的sitemap出错问题
上次改了一下博客后,发现Google不收录新发表的文章,最后发现原因是www.pugwoo.com/sitemap 不正常,出现"A server error occurred. Please contact the administrator."错误。上次不知道怎么搞着搞着就好了,前两天稍微改了下主题,又出现这个问题。
主题的修改和Sitemap生成本身就是毫不相干的事。Micolog在本地测试是能够生成Sitemap的,上传到GAE就出错了。问题很明显,和博客现有的数据有关,如果我清空GAE上的数据那肯定能解决问题,只是下次呢,烦死了这个问题。
接下来就是折腾了,在GAE的出错信息里看不出哪里出问题,于是就不停地注释代码,上传,测试,一行一行排除。发现是blog.py中SitemapHandler这一行:
entries = Entry.all().filter('published =',True).order('-date').fetch(g_blog.sitemap_entries)
中的order('-date')出错,即去掉它就正常了。而www.pugwoo.com/feed 的获取代码是:
entries = Entry.all().filter('entrytype =','post').filter('published =',True).order('-date').fetch(10)
feed工作正常,它就多了个filter('entrytype =','post'),把Sitemap加上这个,竟正常了,奇怪。看了一下Entry表,它的entrytype就两种:post和page,它们的其它属性完全一样,难道是page类出问题了,换成这句:
entries = Entry.all().filter('entrytype =','page').filter('published =',True).order('-date').fetch(g_blog.sitemap_entries)
居然也没有错误。为什么合起来就有问题呢?真是想不明白,还是GAE本身有bug吧,期待高手解答。由于page类文章一般很少,所以将本文最开头SitemapHandler里那一行换成:
entries = Entry.all().filter('entrytype =','page').filter('published =',True).order('-date').fetch(g_blog.sitemap_entries)
entries = Entry.all().filter('entrytype =','post').filter('published =',True).order('-date').fetch(g_blog.sitemap_entries) + entries
就好了。看起来还是没找出问题所在,下一次说不定又来了...
转载请注明:来自pugWoo's Life
本文地址:http://www.pugwoo.com/2010/02/21/micolog-sitemap-error.html
20 条评论
我要留言zpcms 发表于 2010-02-25 at 14:27 回复 引用
我的出现http://www.zpcms.org.ru/sitemap,不知如何解决----
pugwoo 发表于 2010-02-25 at 16:13 回复 引用
这很可能是index.yaml那个文件有问题,我的这个文件的内容是
indexes:
# AUTOGENERATED
# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.
- kind: Comment
properties:
- name: entry
- name: date
- kind: Comment
properties:
- name: entry
- name: date
direction: desc
- kind: Entry
properties:
- name: categorie_keys
- name: date
direction: desc
- kind: Entry
properties:
- name: categorie_keys
- name: published
- name: date
direction: desc
- kind: Entry
properties:
- name: entry_parent
- name: entrytype
- name: published
- name: menu_order
- kind: Entry
properties:
- name: entrytype
- name: date
direction: desc
- kind: Entry
properties:
- name: entrytype
- name: published
- name: date
- kind: Entry
properties:
- name: entrytype
- name: published
- name: date
direction: desc
- kind: Entry
properties:
- name: entrytype
- name: published
- name: post_id
- kind: Entry
properties:
- name: entrytype
- name: published
- name: post_id
direction: desc
- kind: Entry
properties:
- name: entrytype
- name: published
- name: readtimes
direction: desc
- kind: Entry
properties:
- name: entrytype
- name: published
- name: slug
- name: date
- kind: Entry
properties:
- name: published
- name: tags
- name: date
direction: desc
- kind: Entry
properties:
- name: tags
- name: post_id
direction: desc
zpcms 发表于 2010-02-26 at 07:58 回复 引用
pugwoo 发表于 2010-02-26 at 08:27 回复 引用
呵呵,不用客气。
xioxu 发表于 2010-10-24 at 18:42 回复 引用
在我平时使用visual studio的时候,我们可以轻松设置一下,等抛异常的时候,
代码直接断在了出异常的地方,我找了半天没发现Eclipse有这个功能,
我不知道您这方面是否有些经验可以share一下?
mulberry outlet 发表于 2011-11-22 at 16:43 回复 引用
christian louboutin replica high heels in our online uk store. Your shoes sales prices will save. Christian Louboutin Knockoffs shoes sale now, newest styles of christian louboutin high heels in hot sale now. Welcome to purchase!
cheap ugg boots 发表于 2011-11-29 at 11:34 回复 引用
north face jackets 发表于 2011-12-16 at 20:34 回复 引用
Cheap 2012 Black Sha 发表于 2011-12-22 at 15:19 回复 引用
Customized Womens NFL Jerseys
but not cheap.