当 运行 一个 Flask 容器时,pycharm 分析没有输出

No output from pycharm profiling when running a Flask container

运行 PyCharm 4.5.3 Build #141.1899 专业版并获得许可。我 运行 使用 profiler 命令的 Flask 应用程序,其配置类似于:

python app.py

看起来像:

def create_app():
app = Flask(__name__, static_folder='static')
app.register_blueprint(
    consumer_v1.bp,
    url_prefix='/consumer/v1')
return app

app = create_app()

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5001)

当我转到 "Run -> Profile App" 时,我在控制台上看到以下内容:

   /Users/james/.virtualenvs/trustmile-api/bin/python   /Applications/PyCharm.app/Contents/helpers/profiler/run_profiler.py 127.0.0.1 49537 /Users/james/Documents/workspace/trustmile-backend/trustmile/api_stubs/api_stubs/__init__.py
Starting cProfile profiler

2015-09-01 07:00:25,717 INFO  [werkzeug][MainThread]  * Running on http://0.0.0.0:5001/ (Press CTRL+C to quit)
2015-09-01 07:00:25,723 INFO  [werkzeug][MainThread]  * Restarting with stat
2015-09-01 07:00:32,801 INFO  [werkzeug][Thread-1] 127.0.0.1 - - [01/Sep/2015 07:00:32] "POST /consumer/v1/account/password HTTP/1.1" 403 -
Snapshot saved to /Users/XXXX/Library/Caches/PyCharm40/snapshots/trustmile-backend5.pstat
Process finished with exit code 0

但是 UI 中没有显示任何内容,如下所示。

非常感谢任何帮助。

为了解决这个问题,我只是安装了 yappi 而不是默认的 python 分析器。

pip install yappi

希望这对你也有用!