开发者

Using web.py on Appengine

I am looking for a simple python web framework which runs both as standalone and on Appengi开发者_运维百科ne.

I would like to write the app in such a way that i can switch between standalone and Appengine based on the deployment configuration. Standalone will be using RDBMS.

When i checked web.py looked simple and promising. I have the following questions:

  • Does web.py work well on Appengine?
  • Is there any major known gotchas?
  • Can you share your experience with using web.py on Appengine?
  • Any suggestions to achieve the above mentioned goal is appreciated.


Does web.py work well on Appengine?

Yes it does work pretty well, it's compact and very easy to use.

Is there any major known gotchas?

Web.py does not offer any Data Abstraction Layer compatible with GAE; that means that in order to switch from a RDBMS to a NoSQL database, you have to create by yourself a layer above both the web.db database API and the Google App Engine datastore API.

Can you share your experience with using web.py on Appengine?

I have deployed a couple of simple applications with web.py on top of GAE and other several pet projects with Sqlite as database; here a mini review.

Any suggestions to achieve the above mentioned goal is appreciated.

If the switch from Appengine to RDBMS is your primary concern, have a look to web2py.
Although with some limitations, to the best of my knowledge is the only one Python web framework GAE friendly that offers a DAL above the App Engine Datastore and other several RDBMS solutions.
Switching from one db to another is just a matter of initializing the DAL with the proper connection string:

db = DAL('sqlite://storage.db')
db = DAL('mysql://username:password@localhost/test')
db = DAL('gae')


No webapp framework on its own is going to be able to do this - the App Engine environment consists of a lot more than just a database interface and a CGI environment. Even if it could, any DAL that supports both the datastore and a relational DB is likely to sacrifice most of the flexibility of both in pursuit of that.

Your best option, if you want to take advantage of more than just the datastore, is to write your app for App Engine, and use AppScale or TyphoonAE to run your app outside the App Engine environment.


Consider using webapp2. It is similar to web.py, provides basically the same featureset, and runs outside of App Engine out-of-the-box. Besides, you get stellar compatibility with App Engine SDK and libraries (I explain it better here).

You'd only need to add a relational database library. But this is an easy choice: SQLAlqchemy is pretty much the standard in Python land, with lots of documentation and a thriving community.


I would also suggest web2py. Great framework, great community, plays out-of-the-box outside of AppEngine. It also supports a lot of databases (SQLite, PostgreSQL, MySQL, MSSQL, FireBird, Oracle, IBM DB2, Informix, Ingres, and Google App Engine).

On top of that, it's trivial to install it on Linux, Windows, Mac.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜