It would be interesting to implement ModuleLoader in flask. It would make a huge difference in GAE response times for flask applications.
I think you would compile your template with the following script:
SDK_PATH = "/usr/local/google_appengine"
def logger(m, *args, **kw):
from myapp import app
app.debug = True
if __name__ == '__main__':
And with flask 0.7, you would load the compiled template like that:
from flask import Flask
from jinja2 import ModuleLoader
return super(GAEFlask, self).create_global_jinja_loader()
app = GAEFlask('myapp')
This is an ancient issue, and I'm not too familiar with Jinja2 internals. Anyone know if it's still relevant?
@untitaker looks like you started to mark as closing candidate but then thought better of it, I'm curious why? At this point, I'd just close it as an ancient issue with not enough traction...
@dinoboff showed how it is possible, but having ModuleLoader as a default is not very user friendly and usually not fixing the actual bottleneck.