Flask API无法访问索引路由

时间:2019-07-02 00:11:03

标签: rest flask

我正在使用Flask创建一个REST API,并且所有其他端点都按预期工作,但是索引路由给了我create function events_set_performer() returns trigger language plpgsql as $$ declare performer_ varchar := '0'; BEGIN set NEW.performer_id = (string_to_array(NEW.performers,':'))[1]; return new; END; $$;

下面是我的索引路由代码。

404 Not Found

我尝试访问connection_str = config.connection_str db_name = config.db_name app = Flask(__name__) cors = CORS(app) client = MongoClient(connection_str) db = client.get_database(db_name) @app.route('/', methods = ['GET']) def index_route(): return jsonify({ 'author': 'name', 'project': { 'name': 'projname', 'url': 'url', }, 'endpoints': { 'get_all_players': '/players', 'get_player': '/players/{name}', } }) http://127.0.0.1:5000到底有没有localhost:5000。有什么想法吗?

0 个答案:

没有答案