• Flask


    1. 疑问

    @app.cli.command()
    @click.option('--length', default=25,
                  help='Number of functions to include in the profiler report.')
    @click.option('--profile-dir', default=None,
                  help='Directory where profiler data files are saved.')
    def profile(length, profile_dir):
        """Start the application under the code profiler."""
        from werkzeug.contrib.profiler import ProfilerMiddleware
        app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length],
                                          profile_dir=profile_dir)
        app.run(debug=False)
    

    flask web狗书的 git reset --hard 16b
    flask profile --profile-dir="./profile",生成了后缀为*.prof的文件,我怎么查看这些文件呢?
    我发起了一个issue:https://github.com/miguelgrinberg/flasky/issues/365

    2. 解决

    import sys
    from pstats import Stats
    
    my_stat = Stats('file.name', stream=sys.stdout)
    my_stat.print_stats()
    
  • 相关阅读:
    IO
    File
    jdbc
    HashMap
    网络通信
    lambda
    Queue
    反射
    Stack
    AC自动机题目选讲
  • 原文地址:https://www.cnblogs.com/allen2333/p/9150579.html
Copyright © 2020-2023  润新知