When I’m running Jinja2 in Google App Engine, I get useless debugging information. I gather this is because of this item in the FAQ:
My tracebacks look weird. What’s happening?
If the speedups module is not compiled and you are using a Python installation without ctypes (Python 2.4 without ctypes, Jython or Google’s AppEngine) Jinja2 is unable to provide correct debugging information and the traceback may be incomplete. There is currently no good workaround for Jython or the AppEngine as ctypes is unavailable there and it’s not possible to use the speedups extension.
While there is no ‘good’ workaround for this at the moment, is there any workaround so that the information printed when exceptions arise can be made more helpful?
Thank you for reading.
Brian
You can get around this by adding _ctypes and gestalt to the development server’s C module whitelist with monkeypatching.
To do so, put the following snippet at the top of your main.py:
You can also use this trick to enable other C modules, if you have similar local-only module needs. Do note that these modules still won’t actually work once you deploy, so tread carefully.
On SDK 1.6.3 using python2.7 you need to change the above code to:
On SDK 1.8.6 for python 2.7, try this: