繁体   English   中英

如何解决 Heroku 部署中的“方法不允许”

[英]How can I solve "Method not Allowed" in Heroku deploy

我最近尝试在Heroku上部署我的电报机器人,并使用Flask框架编写 webhook 代码。 使用“git push heroku master”部署我的代码开始出现任何问题,但最后我遇到了这个问题,链接“https://git.heroku.com/serene-crag-92322.git”我得到“方法不允许”消息。 请帮我解决这个问题,并在此先感谢您。 我的烧瓶代码:

@app.route('/' + TOKEN, methods=['POST'])
def getMessage():
    json_string = request.get_data().decode('utf-8')
    update = telebot.types.Update.de_json(json_string)
    bot.process_new_updates([update])
    return "!", 200


@app.route("/")
def webhook():
    bot.remove_webhook()
    bot.set_webhook(
        url='https://gentle-temple-77151.herokuapp.com/' + TOKEN)
    return "!", 200


if __name__ == "__main__":
    app.run()

来自 Heroku 的消息:

来自 Heroku 的消息:

Heroku 在构建和部署代码之前使用您的源代码创建一个 git 存储库。 您曾尝试访问外部世界无法访问的私有 Git 存储库(因此出现Method Not Allowed错误消息)。 但是部署 Web 应用程序的实际网站是不同的。 该 Web 应用程序包含您的应用程序名称,如果您在 Heroku 应用程序创建期间提供了一个,否则会为您的 Web 应用程序提供一个随机名称。

Heroku Git 存储库链接: https ://git.heroku.com/serene-crag-92322.git

部署的 Heroku 应用链接: http ://serene-crag-92322.herokuapp.com/

暂无
暂无

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

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