Dear all,

I'm trying to use chameleon templates in a single file application
(obviously the template is not part of that single file).

bash-4.2$ tree
.
├── templates
│   ├── test.mak
│   └── test.pt
├── test_chameleon.py
└── test_mako.py

However, I get the error message:

...
 'Missing template asset: %s (%s)' % (spec, abspath))
ValueError: Missing template asset: templates/test.pt (/home/tolsson/
projects/pyramid_intro/src/env/local/lib/python2.7/site-packages/
pyramid-1.3a5-py2.7.egg/pyramid/templates/test.pt)

bash-4.2$ cat test_chameleon.py
from pyramid.config import Configurator
from wsgiref.simple_server import make_server
from pyramid.response import Response

def test(request):
   return {}

if __name__ == '__main__':
   config = Configurator()
   config.add_route('test', '/')
   config.add_view(test, route_name='test', renderer='templates/
test.pt')
   app = config.make_wsgi_app()
   server = make_server('0.0.0.0', 8080, app)
   server.serve_forever()

I can get it to work using mako:

bash-4.2$ cat test_mako.py
from pyramid.config import Configurator
from wsgiref.simple_server import make_server
from pyramid.response import Response

import os
makodir = os.path.abspath('templates')

def test(request):
   return {}

if __name__ == '__main__':
   config = Configurator()
   config.registry.settings['mako.directories'] = [makodir]
   config.add_route('test', '/')
   config.add_view(test, route_name='test', renderer='test.mak')
   app = config.make_wsgi_app()
   server = make_server('0.0.0.0', 8080, app)
   server.serve_forever()

Clearly, there are some differences here. I've imported os to be able
to create a path to the mako directory and I've set the mako
directories in the config.registry.settings.

Is there something similar I can do to get chameleon to work as a
template rendering engine in a single file application or do I need to
set things up using one of the provided scaffolds?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to