折腾完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 条评论

我要留言
  • 1 F

    zpcms 发表于 2010-02-25 at 14:27 回复 引用

    我的出现http://www.zpcms.org.ru/sitemap,不知如何解决----

  • 2 F

    pugwoo 发表于 2010-02-25 at 16:13 回复 引用

    @zpcms-51001:
    这很可能是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
  • 3 F

    zpcms 发表于 2010-02-26 at 07:58 回复 引用

    @pugwoo-52001: 非常感谢。我的http://www.zpcms.org.ru/sitemap  问题暂时已解决---
  • 4 F

    pugwoo 发表于 2010-02-26 at 08:27 回复 引用

    @zpcms-53001:
    呵呵,不用客气。
  • 5 F

    xioxu 发表于 2010-10-24 at 18:42 回复 引用

    兄弟啊,我是才开始折腾GAE,也是使用micolog,我是使用Eclipse做调试的,
    在我平时使用visual studio的时候,我们可以轻松设置一下,等抛异常的时候,
    代码直接断在了出异常的地方,我找了半天没发现Eclipse有这个功能,
    我不知道您这方面是否有些经验可以share一下?
  • 17 F

    mulberry outlet 发表于 2011-11-22 at 16:43 回复 引用

    啊Mulberry Bags are hot sale with free shipping in Mulberry Outlet Store.Buy Mulberry Bags enjoy top fashion and save up to 70% off now. Discount Mulberry bags sale,Mulberry Outlet.Buy Mulberry bags from our Mulberry factory shop outlet! I purchased a Used Rolex from A&E for my wife on our anniversary. 70%Off Mulberry Bags, Mulberry Sale, Mulberry Purses, Mulberry Alexa, Mulberry Bayswater,Top Quality Free Shipping. Buying
    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!
  • 18 F

    cheap ugg boots 发表于 2011-11-29 at 11:34 回复 引用

    It has been a very long time.ugg boots sale Thank you for this article.Thanks for sharing with us. It’s Very simply explained. However, the uses for this Weston mill are a plenty. If you are a tall level, I think you want to get much Females like Alexander McQueen shoes styles as they are high fashion, I welcome your difficult work on it. It has been a very long time.cheap ugg boots I am really impressed from your posted information. Thanks for sharing. Let's find out together.好
  • 19 F

    north face jackets 发表于 2011-12-16 at 20:34 回复 引用

    引用:Pair it with a seductivebodycon dress and statement jewellery North face apex bionic jacket mens for a chic night out. If you're going away for the weekend, team it with a skirt and wedge boots. Or wear it to the office with a vibrant blouse and a ladylike A-line skirt.
  • 20 F

    Cheap 2012 Black Sha 发表于 2011-12-22 at 15:19 回复 引用

    球衣Sizes of these throwbacks Customized NFL Jerseys will start at small and go to 5X large. With 8 different sizes, you won't have any problem at all finding exactly what you are looking for. These jerseys are actually called replithentic jerseys. Of course, it is replica clothing for youth and adults to enjoy in China but they seem so real and official that you would swear they were all 100% authentic Lights Out Black NFL Jerseys. Most of these throwback uniforms cannot be personalized and customized with your name.An authentic NFL jersey should be as good quality as you would find in the jerseys worn by the NFL players themselves. They are a heavyweight fabric and have all the graphics sewn on, including the numbers, and should last for years. You can also get authentic customized NFL jerseys. You select the name and number of the NFL player you want on the Customized Football Jerseys and this is custom ordered for you exactly how you want it. This can take some time because obviously it has to be made one off especially for you but it means that you get exactly the right NFL jersey for you. This is a great way to order your
    Customized Womens NFL Jerseys
    but not cheap.