migrate4j是一个基于java的数据库迁移的工具,有点象rails里的db:migrate,通过它可以方便使用java代码来记录数据库的变更和快速的将变更还原到数据库,下面是一个migrate4j的例子:
package db.migrations;
import static com.eroi.migrate.Define.*;
import static com.eroi.migrate.Define.DataTypes.*;
import static com.eroi.migrate.Execute.*;
import com.eroi.migrate.Migrat ...
- 11:46
- 浏览 (146)
- 评论 (0)
- 分类: OpenSource
gae不能写文件,所以很多操作只能用datastore来实现了。
class Sequence(db.Model):
@staticmethod
def next():
seq = Sequence()
seq.put()
id = seq.key().id()
seq.delete()
return id
使用
print Sequence.next()
- 02:08
- 浏览 (157)
- 评论 (0)
- 分类: GoogleAppEngine
- 发布在 Google App Engine 圈子
2008-04-15
Restful your google app engine applications
关键字: rest restful gae googleappengine python
使用示例:
#author:pickerel@gmail.com
import wsgiref.handlers
from google.appengine.ext import webapp
from rest import *
class CommentResource(RestResource):
def initialize(self):
self.response.out.write("comment.initialize:format=%s<br/>" %(self.format))
def index(self, ...
- 01:47
- 浏览 (211)
- 评论 (0)
- 分类: GoogleAppEngine
- 发布在 Google App Engine 圈子
def foo(a, b, c):
return a + b + c
positionals = (1, 2)
keywords = {'c': 3}
foo(*positionals, **keywords)
Google App Engine自带了django框架,开发者可以直接在上面使用django开始web程序,如果你不打算去学django框架,而只是想用它的模板机制,那也是可以的,这里以一个hello, world为例做个演示:
文件:./simple_blog/app.yaml
application: simple-blog
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: simple_blog.py
文件:./simple_blog/simple_blog.py
#!/usr/bin ...
- 23:07
- 浏览 (319)
- 评论 (0)
- 分类: GoogleAppEngine
- 发布在 Google App Engine 圈子
在Google App Engine中内置了yaml文件的验证、解析方法,下面演示一个在GAE中读取yaml的例子
待读取的配置文件 config.yaml 内容如下:
blog_name: 我们的博客
allow_comment: False
masters:
- name: Pickerel Yee
account: pickerel@gmail.com
- name: 王二
account: wang2@gmail.com
建立配置验证读取文件 config.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
impor ...
- 22:53
- 浏览 (217)
- 评论 (0)
- 分类: GoogleAppEngine
- 发布在 Google App Engine 圈子
在windows下运行一个示例工程的时候返回错误
regex invalid: unbalanced parenthesis
修正:
找到 google\appengine\tools\dev_appserver.py 文件,到2369行把以下两行代码
regex = os.path.join(re.escape(regex), '(.*)')
path = os.path.join(path, '\\1')
修改为
regex = re.escape(regex) + '/(.*)'
path = path + '/\\1'
在 ...
- 10:24
- 浏览 (152)
- 评论 (0)
- 分类: GoogleAppEngine
- 发布在 Google App Engine 圈子







评论排行榜