python - flask部署服务器出错
巴扎黑
巴扎黑 2017-04-17 14:34:48
0
2
421

我在用flask搭建一个简单的个人博客.
由于没有顺手的能够嵌入网站markdown编辑器,而我又十分喜欢马克飞象的效果,所以就想着用evernote api把马克飞象渲染后的笔记读出来然后转换成HTML格式的(其实也没做太多,或者说几乎没做).
在本地测试的时候,除了读取笔记慢一点还算比较正常.
但是部署在Digital Ocean后有一点总时出错.
如果直接Python example.py运行的话是没什么问题,但是如果用nginx和uwsgi就总是有问题.
就是我在连接印象笔记的服务器的时候,log中总是报一个错:

File "/usr/lib/python2.7/httplib.py", line 1131, in getreply
self.file = self._conn.sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'
'

只要调用用到这个makefile就会出错.
httplib2版本是0.9的,os是ubuntu14.02 x64, 另外会和nginx + uwsgi有关系吗?
Stackoverflow和google了好久也没看到个解决方法.
貌似不太像是httplib的bug,比较有可能是部署配置的问题,但是一直也找不到问题.
如果需要其他的调试信息可以告我,我来补充.
麻烦大家了.
多谢了.

巴扎黑
巴扎黑

reply all(2)
巴扎黑

Looking at the log, it seems that self._conn.sock is None, so I guess there may be a problem with your HTTP link

黄舟

https://code.google.com/p/httplib2/issues/detail?id=62
When the server rejects your request, both httplib and httplib2 will report this error.
Did your past request headers contain some fields that should not have been included after you deployed them as a service, so they were rejected by you?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!