Python Tornado Web - AttributeError:“连接”对象没有属性“_execute”;
当我在生产服务器上部署应用程序时,我在使用tornadoweb的最新分支时遇到了奇怪的行为。
我对代码进行了多次测试,当我使用 python 2.6.3 和 MySQLdb 1.2.3b2 在我的笔记本电脑 (Archlinux) 上测试它时,它完全可以工作。
一旦我使用 python 2.6.2、MySQLdb 1.2.3.c1(也测试了 1.2.1 版本)在我的生产服务器(Ubuntu x64)上部署并调用该页面,就会引发此错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/tornado/web.py", line
688, in _execute
getattr(self, self.request.method.lower())(*args, **kwargs)
File "/var/www/app.py", line 122, in get
self.store_db('cc',test)
File "/var/www/app.py", line 82, in store_db
self.db.execute(query)
File "/usr/local/lib/python2.6/dist-packages/tornado/database.py",
line 132, in execute
self._execute(cursor, query, parameters)
AttributeError: 'Connection' object has no attribute '_execute'
奇怪的行为是另外,在我的笔记本电脑上测试本机演示(称为博客)它工作正常,但是一旦我将其部署到生产中,它就会停止工作,并解决上面列出的问题。
我必须补充一点,db.get
/ db.query
函数工作正常。
I'm experiencing a strange behaviour working with the latest branch of tornadoweb when I deploy my app on my production server.
I tested several times the code and it is fully working when I test it on my laptop (Archlinux) with python 2.6.3 and MySQLdb 1.2.3b2.
As soon as I deploy on my production server (Ubuntu x64) with python 2.6.2, MySQLdb 1.2.3.c1 ('ve tested also with 1.2.1 version) and call for that page it raises this error:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/tornado/web.py", line
688, in _execute
getattr(self, self.request.method.lower())(*args, **kwargs)
File "/var/www/app.py", line 122, in get
self.store_db('cc',test)
File "/var/www/app.py", line 82, in store_db
self.db.execute(query)
File "/usr/local/lib/python2.6/dist-packages/tornado/database.py",
line 132, in execute
self._execute(cursor, query, parameters)
AttributeError: 'Connection' object has no attribute '_execute'
The strange behaviour is also that testing the native demo (called blog) on my laptop it works fine, but as soon as I deploy it in production it stop working with the save trouble listed above.
I have to add that db.get
/ db.query
functions works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于解决了问题,迁移到新的 ubuntu x64 而不是使用 i386 版本。
I finally fixed my problem moving to a fresh ubuntu x64 instead of using a i386 version.