Using Mako Templates in Pyramid with Google App Engine

Using Pyramid and mod_wsgi to use mako templates, you simply add this line to development.ini:

mako.directories = house:templates 

Unfortunately, Pyramid on Google App Engine does not have a development.ini file, and I get the following error:

 File "appengine-monkey/pyramidapp/app/lib/python/pyramid-1.0a9-py2.5.egg/pyramid/mako_templating.py", line 74, in renderer_factory 'Mako template used without a ``mako.directories`` setting') ConfigurationError: Mako template used without a ``mako.directories`` setting 

Is there a way to pass this environment variable?

+4
source share
1 answer

I found out from the pylons-devel mailing list. I realized that I will post the answer here.

The way to do this is to pass it to the configurator as a parameter. Therefore, in the __init__.py file, make the following change:

 config = Configurator(settings={'mako.directories':['house:templates']}) 
+9
source

Source: https://habr.com/ru/post/1336210/


All Articles