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)
评论列表
文章目录