繁体   English   中英

在金字塔中渲染mako模板时出现未知谓词值错误

[英]Unknown predicate values error while rendering mako template in pyramid

渲染mako模板时,我收到ConfigurationError('未知谓词值:%r'%(kw,)) 以下是我的金字塔项目的结构。

我的金字塔项目树。

|-- web
|-- myweb
    |-- templates
        |-- index.mak
    |-- __init__.py
    |-- views.py
|-- development.ini
|-- production.ini

web / myweb / views.py

class Main(object):
def __init__(self, request):
    self.request = request
def __call__(self):
    return {}

web / myweb / __ 初始化 __.py

config.add_route('main', '/',
                 view='myweb.views.Main',
                 renderer='index.mako')

这是我遇到错误的地方

 raise ConfigurationError('Unknown predicate values: %r' % (kw,))
 pyramid.exceptions.ConfigurationExecutionError: <class   pyramid.exceptions.ConfigurationError'>: Unknown predicate values: {'renderer': 'index.mako', 'view': 'myweb.views.Main'}
  in: Line 33 of file /home/user/project/web/myweb/__init__.py:
renderer='index.mako')

这是我的.ini文件

development.ini

[app:myweb]
mako.directories = web:myweb:templates

production.ini

[app:myweb]
mako.directories = web:myweb:templates

我不知道我缺少什么以及导致此错误的原因。

为了说明这一点, __init__.py init__.py引用模板“ index.mako”,而文件称为“ index.mak”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM