问题描述
mongodb数据库连接不上
$ python2 Run.py
Traceback (most recent call last):
File "Run.py", line 1, in <module>
from views.View import app
File "/path/to/xunfeng/views/__init__.py", line 12, in <module>
app.config.get('DBUSERNAME'), app.config.get('DBPASSWORD'))
File "/path/to/xunfeng/views/lib/Conn.py", line 13, in __init__
self.coll.authenticate(username, password)
...
File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 210, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Authentication failed.
解决方法
问题描述
xlwt模块没有找到
$ python2 Run.py 1 ↵
Traceback (most recent call last):
File "Run.py", line 1, in <module>
from views.View import app
File "/path/to/xunfeng/views/View.py", line 10, in <module>
from lib.CreateExcel import *
File "/path/to/xunfeng/views/lib/CreateExcel.py", line 3, in <module>
import xlwt
ImportError: No module named xlwt
解决方法
安装xlwt包 解决了.
$ sudo pip2 install xlwt
问题描述
socket权限问题
$ python2 Run.py
Traceback (most recent call last):
File "Run.py", line 5, in <module>
app.run(threaded=True, port=80,host='0.0.0.0')
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 841, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 691, in run_simple
s.bind((hostname, port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 13] Permission denied
解决方法
直接使用sudo权限 解决了 ^2
问题描述
端口被占用
$ sudo python2 Run.py 1 ↵
Traceback (most recent call last):
File "Run.py", line 5, in <module>
app.run(threaded=True, port=80,host='0.0.0.0')
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 841, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 699, in run_simple
s.listen(LISTEN_QUEUE)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
解决方法
将 run.py 的port 80 换成 800 即可. ^3
from views.View import app
if __name__ == '__main__':
app.debug = True
app.run(threaded=True, port=800,host='0.0.0.0')
处理完毕, 终于可以运行了.
$ sudo python2 Run.py
* Running on http://0.0.0.0:800/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 290-209-200