Differences, limitations, and open issues re Pylons applications running on Google App Engine.
Installation/configuration issues
You're application's main Python module should instantiate the Pylons application at the global level, and have a main() function that connects it to the webapp server. This allows the application to remain in memory as long as its server instance exists. (GAE creates/discards server instances according to demand.)
(XXX show a sample main() function.)
The entire application, ini file, and static files must be uploaded to the server. It's not possible to have multiple .ini files on the server and switch between them.
App Engine Monkey
provides some needed patches to make Setuptools work under GAE. This is needed for Pylons. In the future we'd like to package these up in a more integrated way.
app.yaml vs production.ini
GAE has an app.yaml file that dispatches to your application, thus a layer above production.ini. The [server] section of production.ini is not used in GAE.
Static files
GAE serves static files in its own way, and it even removes them from the upload so the application can't access them directly. Thus removes the need for the Cascade middleware (its JavascriptsApp is also deprecated in Webhelpers 0,6-dev). However, you cannot configure the entire public directory as an overlay over "/" or you'll lose your application. You have to configure each static subdirectory separately in app.yaml, along with favicon.ico and robots.txt.
Mako, Genshi, Beaker, and Routes
The latest version or development version of Mako is supposed to work on App Engine. Likewise, the latest/development version of Beaker can store sessions in Datastore. Routes should have no problems.
Mako
As AppEngine works on a sandboxed environment, you can't use mako cache. Comment out the ``module_directory`` argument to TemplateLookup in environment.py or set it to None. In Pylons 0.9.7:
1
2
3
4
5
6 | config['pylons.app_globals'].mako_lookup = TemplateLookup(
directories=paths['templates'],
@module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
input_encoding='utf-8', output_encoding='utf-8',
imports=['from webhelpers.html import escape'],
default_filters=['escape'])
|
In Pylons 0.9.6:
1
2
3 | # Customize templating options via this variable
config['buffet.template_options']['mako.module_directory'] = None
tmpl_options = config['buffet.template_options']
|
It may be possible to use Beaker's Datastore backend for cached templates.
We've also gotten a report that Mako can't read templates in zipped eggs.
Error reports
Error messages, tracebacks, ...
Database
See Datastore Issues.