In the past few months, I have developed two simple applications on Baidu App Engine. Compared to Google App Engine, or Nitrous.Io, the documentation of BAE is really not good enough. The only advantage of BAE is stable - you needn't to worry about GFW - on Mainland China. I'm used to CherryPy to do simple web applications, and after some attempts, I figure out how to deploy it to BAE:

1. Create a deployment on BAE

Remember to select the type as python-web. 

2. Checkout and modify code

When done, notice these files:

requirements.txt

As the documentation says, this is where we declare the library dependencies we want. So we just write:

cherrypy

app.conf

Here to let it work, modify it like this:

handlers:
- url : /*
script: index.py - expire : .jpg modify 10 years
- expire : .swf modify 10 years
- expire : .png modify 10 years
- expire : .gif modify 10 years
- expire : .JPG modify 10 years
- expire : .ico modify 10 years

The key here is that url property should be /* rather than /. And notice index.py is the entrance of your application.

index.py

Basiclly, this file will look like this:

#-*- coding:utf-8 -*-
import cherrypy
import script try:
from bae.core.wsgi import WSGIApplication
app = cherrypy.tree.mount(script.HelloWorld(environment), "/", config=script.CONFIG)
application = WSGIApplication(app)
except ImportError:
cherrypy.quickstart(script.HelloWorld(environment), config=script.CONFIG)

Here the 'script.py' is just a file I created to handle the actual logic. The key here is WSGIApplication which is offered by BAE, and we should wrap our app created by CherryPy framework with it. Using try... except structure here, we can use same code both on BAE and on local environment, which makes debugging more convenient.

3. Problem remain: Session

It seems that the session function will not work very well on BAE, I've tried different configurations but can't make it. Next time I will go into it and try to figure out the reason.

Example: Develop Web application on Baidu App Engine using CherryPy的更多相关文章

  1. 第一个Django项目及部署到Sina App Engine

    Sina App Engine简称SAE,是个比较好的网站托管平台,目前说是全面免费,其实就是每个人分配很小的资源配额,在一定的使用范围内不用消耗云豆(SAE计费方式),对于个人学习和研究足够了,同类 ...

  2. 云计算平台简介(App Engine)

    云计算平台简介(App Engine)     1   简介 App Engine: 应用程序引擎,是托管网络应用程序的云计算平台. 1.1  什么是云 云计算通常简称为“云”,是一种通过 Inter ...

  3. What technical details should a programmer of a web application consider before making the site public?

    What things should a programmer implementing the technical details of a web application consider bef ...

  4. Google App Engine, Python2.7的UnicodeDecodeError bug

    在跟Web Development,要在Google App Engine上写作业,出师不利,遇到以下bug: 2014-05-06 16:14:17 Running command: "[ ...

  5. 介绍Google App Engine

    Google App Engine是一个网络应用托管服务(web application hosting service).所谓网络应用(By web application),我们的意思的可以通过网 ...

  6. Google App Engine 学习和实践

    这个周末玩了玩Google App Engine,随手写点东西,算是学习笔记吧.不当之处,请多多指正. 作者:liigo,2009/04/26夜,大连 原创链接:http://blog.csdn.ne ...

  7. [Windows Azure] Adding Sign-On to Your Web Application Using Windows Azure AD

    Adding Sign-On to Your Web Application Using Windows Azure AD 14 out of 19 rated this helpful - Rate ...

  8. Collabration Web Application Screenshot(English Language) Free download now!

    The screenshots of english language version collabration web application which is as following: Incl ...

  9. Python Flask 在Sina App Engine (SAE)上安家

    早就听说了Python的大名,随着的编程语言的理解加深,越发认为动态语言的威力--真大呀. 趁这段时间不忙,我也用Python写了一个应用,而且将其部署到Sina App Engine (SAE).S ...

随机推荐

  1. Loader之一:基本原理

    参考APIDEMO及http://developer.android.com/guide/components/loaders.html#app 1.Introduced in Android 3.0 ...

  2. jQuery的事件和动画

    1.animate的应用 animate(params,[duration],[easing],[callback]) 参数实例: params:     {width:"20%" ...

  3. Drawable复习—第六章

    一.Drawable的分类及使用 复习知识:①.Drawable有几种类别. ②.在哪里利用xml创建Drawable  ③.类中各个类别如何使用  ④.Drawable的插值器和设置时常.是否保持动 ...

  4. cocos2d-x中的Box2D物理引擎

    在Cocos2d-x中集成了2个物理引擎,一个是Chipmunk,一个是Box2D.前者是用C语言编写的,文档和例子相对较少:Box2D是用C++写的,并且有比较完善的文档和资料.所以在需要使用物理引 ...

  5. Oracle EBS-SQL (INV-8):检查物料入库明细信息.sql

    select a.vendor_number             供应商编码      ,a.vendor_name                   供应商名称      ,a.item_nu ...

  6. Amzon MWS API开发之 上传数据

    亚马逊上传数据,现有能操作的功能有很多:库存数量.跟踪号.价格.商品....... 我们可以设置FeedType值,根据需要,再上传对应的xml文件即可. 下面可以看看FeedType类型 这次我们拿 ...

  7. QT下的几种透明效果(三种方法:调色板,透明度属性,自绘)

    1.窗口整体透明,但是窗体上的控件不透明.    通过设置窗体的背景色来实现,将背景色设置为全透.  QPalette pal = palette();  pal.setColor(QPalette: ...

  8. android keytool 不是内部命令或外部命令在 (win7下不能用的解决方法)

    android 关于MD5指纹中 keytool在win7下不能用的解决方法 只要在cmd中执行如下命令即可:注意C:\Users\Administrator\.android\debug.keyst ...

  9. 如何让vnc控制由默认的twm界面改为gnome?(转)

    其实只要修改用户 .vnc目录下的xstartup配置文件即可 [root@localhost ~]# more /root/.vnc/xstartup#!/bin/sh # Uncomment th ...

  10. [置顶] 如何把你的笔记本电脑变成一个Wi-Fi路由器在Windows 7 & 8?

    翻译自:http://www.hakanakdag.net/windows/how-to-create-wireless-ad-hoc-internet-connection-in-windows-8 ...