Posts tagged GAE

GHS的IP全线阵亡

就在今天,大家的Micolog博客全线阵亡,没有一个躲过此次浩劫,大家一起哀悼吧!

主要原因是归结在基于GAE的twitese服务(推特中文圈),和一些基于GAE架设的twitter-api,虽然如此,但是我们要和twitese一起矛头指向G。W.F。

顺便介绍下twitese

Twitese推特中文圈旨在帮助中国twitter使用者寻找国内优秀twitter用户,同时让大陆用户无需翻墙即可更新状态和浏览好友消息。

Twitese有两个版本,其一架设在Google App Engine上,由java语言编写,另一个PHP版本开源,可由任何人自由架设在自己服务器上,详细。开源主页:http://code.google.com/p/twitese/

还有就是昨天的pr全面更新,www.ddig.info和my2first.appspot.com  pr为3,my2first.appspot.com为何也3?

很多pr1文章和一个pr2的文章,虽然pr对于我们没有什么用处,但是pr从0到3,也是对我的肯定,百度k了www.ddig.info 3次,现在只收录了首页,权重还可以,搜索“qing”,排名第4。

在此谢过和我做友情链接的朋友,大家的评论鼓舞着我还要坚持写下去,和大家做朋友,交流和分享。

感谢大家,还有来我博客留言的朋友们。

最后也是最主要的,我们要继续,要坚持下去,好像继续GAE+Micolog的成本提至很高,连www.kunshou.net都已经走向反向代理了(我以前一直cname他的域名)。

所以大家一起商量怎么办

1.国内空间?至少我不会考虑。

2.找国内靠谱的合租发起人购买空间,这个感觉不错。

3.大家一起合租,就是麻烦了一点,这个最好,呵呵。

4.想办法我们也做反向代理,这个我不擅长,不过有houkai在,继续micolog,哈哈。

Google App Engine 301 永久重定向

由于我想把my2first.appspot.com的流量都转移到www.ddig.info上,也有搜索引擎方面的原因,所以我想把my2first.appspot.com上的内容重定向到www.ddig.info上。

1. class MainPage的get方法第一行添加

if self.request.headers["Host"] == ‘my2first.appspot.com’:

self.redirect(”http://www.ddig.info/”)

self.response.set_status(301)

2. class SinglePost的get方法

if not entries or len(entries) == 0:

return self.error(404)

的下面添加

if self.request.headers["Host"] == ‘my2first.appspot.com’:

self.redirect(”http://www.ddig.info/”+slug)

self.response.set_status(301)

3. class SitemapHandler的get方法下第一行添加

if self.request.headers["Host"] == ‘my2first.appspot.com’:

self.redirect(”http://www.ddig.info/sitemap”)

self.response.set_status(301)

上边其实也可以不加self.response.set_status(301),self.redirect方法加上第二个参数True也可以,这样是Google推荐的方法。

if self.request.headers["Host"] == ‘my2first.appspot.com’:

self.redirect(”http://www.ddig.info/sitemap”, True)

4. 注意清楚缓存和代码缩进,tinymce的空格问题真麻烦 已经解决,我换了最新版的Tinymce已经不存在这个问题。

这样基本就差不多了

以上实例只限Micolog程序。

我可不赞成这样pr作弊!

micolog上传favicon.ico错误

在micolog上传的过程中,会出现

Could not guess mimetype for static/images/favicon.ico. Using application/octet-stream.

但是并不影响使用

可以感觉不是那么好

其实很好解决

主要是因为在app.yaml中定义favicon.ico的路径时,忘了定义文件类型。

- url: /favicon\.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico
mime_type: image/x-icon

这样就可以了

在GAE上搭建 Micolog博客

在此之前,甚至包括去年年底,我都曾尝试在Google App Engine 上搭建自己的博客,可是都失败了。

现在我要把我搭建的过程中出现的错误总结一下。

首先,可以参考下这篇文章http://www.kgblog.net/2009/05/30/micolog-bug.html

1.一定要把app.yaml文件的第一行

application: my2first

my2first更改为自己的id,记住中间有一空格。

先不要再自己的环境下测试,要不会生成很多编译过的文件。

2.更改index.yaml文件,这个是由于Google App Engine的更新,现在不能识别单属性的索引,解决办法就是删除单name属性的索引。

比如:

# Unused in query history — copied from input.
- kind: Archive
properties:
- name: date
direction: desc

这是我上传成功的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.

# Used once in query history.
- kind: Comment
properties:
- name: entry
- name: date

# Unused in query history — copied from input.
- kind: Comment
properties:
- name: entry
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: categorie_keys
- name: date
direction: desc

# Used 29 times in query history.
- kind: Entry
properties:
- name: entry_parent
- name: entrytype
- name: published
- name: menu_order

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: entry_type
- name: date
direction: desc

# Used 4 times in query history.
- kind: Entry
properties:
- name: entrytype
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: entrytype
- name: post_id

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: entrytype
- name: post_id
direction: desc

# Used 11 times in query history.
- kind: Entry
properties:
- name: entrytype
- name: published
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: entrytype
- name: published
- name: slug
- name: date

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: entrytype=
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: published
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: slug
- name: date

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: tags
- name: date
direction: desc

# Unused in query history — copied from input.
- kind: Entry
properties:
- name: tags
- name: post_id
direction: desc

# Unused in query history — copied from input.
- kind: Link
properties:
- name: linktype
- name: createdate
direction: desc

# Unused in query history — copied from input.
- kind: Link
properties:
- name: linktype
- name: href

3.上传,这时候你要确定你的数据库是干净的,运行

appcfg.py update micolog。

4.打开主页,出现

A server error occurred. Please contact the administrator.

等待,这时候千万不要着急。GAE的数据库状态由Buliding 状态变为Serving状态现在需要花费时间,我就等了差不多有10分钟,当状态变为saveing时,访问首页, hello world!出现了吧。

哈哈!

终于成功了!

Oh!My God!

感谢徐明!

感谢Google App Engine

明天写个教程,把我的建设痛苦经历写出来!