我已经尝试按照将 mongokit 集成到 pylons 的指南进行操作:http: //namlook.github.com/mongokit/pylons.html
当我带着贴纸去服务时,它会引发错误:
File "/home/ciferkey/Projects/runnr-site/runnrsite/config/environment.py", line 29, in load_environment
config['pylons.app_globals'] = app_globals.Globals(config)
TypeError: __init__() takes exactly 1 argument (2 given)
如果我将一个虚拟参数放入Globals的init中:
def __init__(self, foo):
然后它不再抛出错误,而是抛出:
File "/usr/lib/pymodules/python2.6/pylons/configuration.py", line 141, in __getitem__
return dict.__getitem__(self, name)
KeyError: 'db_host'
现在这是引用指南告诉您输入的 lib/app_globals.py 中的行:
self.connection = Connection(
host = config['db_host'],
port = int(config['db_port']),
)
我知道我要用实际信息替换 db_host 和 db_port,但无论我尝试什么,它都会引发相同的错误。关于为什么会发生这种情况的任何想法?