我已经安装了一个基本的Flask应用程序,它使用pydevd
来远程调试python应用程序。我们还使用了uwsgidecorators的postfork()
方法。代码看起来像这样
from flask import Flask
import sys
sys.path.append('pycharm-debug.egg') # replace by pycharm-debug.egg for Python 2.7
import pydevd
# the following line can be copied from "Run/Debug Configurations" dialog
pydevd.settrace('localhost', port=4444, stdoutToServer=True, stderrToServer=True)
print __name__
application = Flask(__name__)
@application.route('/')
def hello_world():
return 'Hello World!'
def initialize():
print "This is called"
try:
from uwsgidecorators import postfork
postfork(initialize)
except ImportError:
pass
if __name__ == '__main__':
application.run(host='0.0.0.0', port=8055)
那个网址:uWSGI.ini文件看起来像这样
[uwsgi]
module = app
socket = 0.0.0.0:8000
master = true
现在,当我尝试运行uwsgi ./uwsgi.ini
时,调试器确实在第一行中断,即在print __name__
上,但应用程序没有启动。需要注意的一点是postfork()不调用intialize
方法。经过一些尝试和错误,如果我删除了pydev.settrace
,我就可以运行应用程序了,我需要能够调试应用程序。有人知道这是怎么回事吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐