在自己的机器的上试跑下,结果出现错误sqlalchemy.exc.InvalidRequestError
ragnraok opened this issue · 3 comments
ragnraok commented
数据库使用的是SQLite一开始像这里说的一样,改成"flask.ext"之后能够建立数据库,然后执行python run runserver
之后,出现以下错误:
sqlalchemy.exc.InvalidRequestError
InvalidRequestError: On relationship Topic.notify, 'dynamic' loaders cannot be used with many-to-one/one-to-one relationships and/or uselist=False.
Traceback (most recent call last):
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
return self.wsgi_app(environ, start_response)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ragnarok/Resource/flask/Feather/feather/views/topic.py", line 82, in index
(usercount, topiccount, replycount) = get_sitestatus()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask_cache/__init__.py", line 216, in decorated_function
rv = f(*args, **kwargs)
File "/home/ragnarok/Resource/flask/Feather/feather/views/topic.py", line 40, in get_sitestatus
usercount = User.query.count()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/flask_sqlalchemy.py", line 394, in __get__
mapper = orm.class_mapper(type)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/util.py", line 1128, in class_mapper
mapper = _inspect_mapped_class(class_, configure=configure)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/util.py", line 1061, in _inspect_mapped_class
mapperlib.configure_mappers()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 2048, in configure_mappers
mapper._post_configure_properties()
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 1233, in _post_configure_properties
prop.post_instrument_class(self)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/interfaces.py", line 461, in post_instrument_class
self.strategy.init_class_attribute(mapper)
File "/home/ragnarok/Resource/flask/Feather/venv/lib/python2.7/site-packages/sqlalchemy/orm/dynamic.py", line 30, in init_class_attribute
"uselist=False." % self.parent_property)
InvalidRequestError: On relationship Topic.notify, 'dynamic' loaders cannot be used with many-to-one/one-to-one relationships and/or uselist=False.
系统环境:
$ uname -a
Linux ragnarok-Aspire-4741 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
yetone commented
对不起,这是我的错误,由于当初构建时考虑不慎,故在大量运用多对多映射,所以这个版本已经废弃,我准备用 Tornado 重构之,由于接了个外包,所以迟迟未能动手,造成的麻烦还请见谅。
ragnraok commented
Soga....
hit9 commented
好吧,跑出这个错误了我才看到