简体   繁体   English

如何在 windows 和 pycharm 上调试 falcon 应用程序?

[英]How to debug falcon app on windows and pycharm?

there is a way to debug a falcon app on windows?有没有办法在 windows 上调试猎鹰应用程序? I'm using Pycharm.我正在使用 Pycharm。

I use waitress to run from the command line, but I have no idea how to debug my source code.我使用女服务员从命令行运行,但我不知道如何调试我的源代码。

I have used pycharm 2018 and I have not found any support for debug falcon app(maybe I could be wrong ).我使用了 pycharm 2018 并且我没有找到对调试 falcon 应用程序的任何支持(也许我可能是错的)。 What I have done is make a different file on same directory and put all function over there and debug that file as normal python script or.我所做的是在同一目录上创建一个不同的文件,并将所有 function 放在那里,并像正常的 python 脚本或调试该文件。 May be you can use print or kind of unit test to test your code.也许您可以使用打印或某种单元测试来测试您的代码。

Maybe I don't get the question.也许我没有得到这个问题。 I use Pycharm to develop a falcon REST API on windows.我使用 Pycharm 在 Z0F4137ED1502B5045DZ608C 上开发猎鹰 REST API。 No problems in debugging whatsoever.调试没有任何问题。 You just need to set a run configuration by setting the Script path to point to the file with the waitress.serve line and then launch it as Debug instead of Run .您只需要通过将脚本路径设置为指向带有waitress.serve行的文件来设置运行配置,然后将其作为Debug而不是Run 启动

In my case the file looks like this:在我的情况下,文件如下所示:

from api_falcon.app import api as application

if __name__ == '__main__':
    import os
    import waitress
    waitress.serve(application, host=os.getenv('MYAPI_WSGI_HOST', '0.0.0.0'), port=os.getenv('MYAPI_WSGI_PORT', '8080'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM