分类: LINUX
2011-12-19 14:58:21
今天测试的时候出现一个错误:sqlalchemy.exc.UnboundExecutionError: Could not locate a bind configured on mapper Mapper|Keyv|fileinfo or this Session
查了下网上的资料,都是E文的,大致意思是,在你调用Session.configure(bind=engine)之前实例化了一个Session,Session不能绑定到engine上去所致
在代码中加上下列代码可以解决这个问题:
from paste.deploy import appconfig
from pylons import config
from project.config.environment import load_environment
conf = appconfig('config:../../development.ini', relative_to='.')
load_environment(conf.global_conf, conf.local_conf)
from project.model import *