server.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:aw-server 作者: ActivityWatch 项目源码 文件源码
def _start(storage_method, host, port, testing=False):
    # TODO: This should probably be more specific
    origins = "moz-extension://*"
    if testing:
        # CORS won't be supported in non-testing mode until we fix our authentication
        logger.warning("CORS is enabled when ran in testing mode, don't store any sensitive data when running in testing mode!")
        origins = "*"
    # See: https://flask-cors.readthedocs.org/en/latest/
    CORS(app, resources={r"/api/*": {"origins": origins}})

    # Only pretty-print JSON if in testing mode (because of performance)
    app.config["JSONIFY_PRETTYPRINT_REGULAR"] = testing

    db = Datastore(storage_method, testing=testing)
    app.api = ServerAPI(db=db, testing=testing)
    app.run(debug=testing, host=host, port=port, request_handler=FlaskLogHandler, use_reloader=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号