문제

I upgraded to Python 1.4.5 and when I try to run my project here is the error:

ValueError: No such renderer factory .mak
[Applications/MAMP/htdocs/WhoAt/env/www/www/views/index/index.py line:32]
get()
     ->return self.render(mak)

[Applications/MAMP/htdocs/WhoAt/env/www/www/views/__init__.py line:231]
render()
     ->response = render_to_response(template, context, request=self.request)

[Applications/MAMP/htdocs/WhoAt/env/lib/python2.7/site-packages/pyramid/renderers.py line:138]
render_to_response()
     ->return helper.render_to_response(value, None, request=request)

ValueError: No such renderer factory .mak

I looked this up yesterday and learned that mako templates aren't supported by default anymore. And they have to be added back in: What's New In Pyramid 1.5

I followed the steps on that docs page, but am still getting the error :(

In the init.py

config.include('pyramid_mako') # < added that
config.add_static_view('static', 'static', cache_max_age=3600)
config.scan()
return config.make_wsgi_app()

And in the setup.py added 'pyramid_mako' and chameleon

requires = [
    'pyramid',
    'pyramid_mako',
    'pyramid_chameleon',
    'pyramid_debugtoolbar',
    'waitress',
]

Also ran the setup.py in terminal :(

Has anyone else run into problems fixing mako templates in PyCharm?

A print list of my pip freeze: http://codepen.io/leongaban/pen/Bvakw/

도움이 되었습니까?

해결책

Had to recreate my VirtualEnv and start fresh. Was able to fix the missing mak problem

Answer here What version of Pyramid do I have and what's the best way to update? by @madjar

다른 팁

Since i was also suffering from the same problem (No such renderer factory .mak) i was wondering for the solution. Then i got a link of https://pypi.python.org/pypi/pyramid/1.5a2 and it helped me to get out of this problem. This error means that the application is searching for a template either it is mako or chameleon but since it fails to find out the Renderer our application throws this error.

The main reason of this error is that, In pyramid 1.5a2+, the Pyramid community is moving mako tepmlate in a package named pyramid_mako and the chameleon template is being moved to a package named pyramid_chameleon.

So to solve this problem i made some changes in my setup.py and __init.py__.

Case1. If your templating system is chameleon in setup.py add following lines in

setup(..........)

install_requires=[ 'pyramid_chameleon', 'pyramid', ], And in __init__.py add following lines

config.include('pyramid_chameleon')

Case2 If your templating system is mako in setup.py add following lines in

setup(..........)

install_requires=[ 'pyramid_mako', 'pyramid', ], And in __init__.py add following lines

config.include('pyramid_mako')

Then try to run the setup.py and then run the develpoment.ini

I set up project using starter scaffolding which takes by default chameleon. So after changing it to jinja2 in setup.py and init.py had an similar error but in my case it was .pt

So what was happening is it's still calling the default templating engine in views.py it had previously so changed it on views.py. Add the respective template file in the template directory with respective file.For example I removed the .pt format file and added the .jinja2 template files.

Don't forget to use the respective format for the template you are using. Worked well than

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top