在GAE(Google App Engine)上搭建python2.7的web.py程序
资源:
1、下载GAE的sdk for python。https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python
2、下载GAE支持的python版本。python2.5和python2.7
3、下载python的flup模块。【前提保证安装了setuptools,否则不能安装python模块】
4、安装MySQLdb模块。【可选,如果要用到mysql数据库的话】
体验hello world:
1、新建一个helloworld目录,注意是小写
2、其下新建一个helloworld.py文件
3、添加如下内容:
#encoding: utf-8import webrender = web.template.render('templates/', cache=False)urls = ('/(.*)', 'hello')app = web.application(urls, globals())class hello: def GET(self, name):if not name: name = 'World'return render.index(name)if __name__ == "__main__":app.cgirun() 5、编译模板文件,原因网上都有。在helloworld主目录下运行如下命令: