[英]How can I solve "Method not Allowed" in Heroku deploy
I recently tried to deploy my telegram bot on Heroku and I use Flask framework for write webhook code.我最近尝试在Heroku上部署我的电报机器人,并使用Flask框架编写 webhook 代码。 With using "git push heroku master" deploying my codes began with any problems, But at the end I encountered this problem that the link "https://git.heroku.com/serene-crag-92322.git" I get "Method Not Allowed" message.
使用“git push heroku master”部署我的代码开始出现任何问题,但最后我遇到了这个问题,链接“https://git.heroku.com/serene-crag-92322.git”我得到“方法不允许”消息。 Please help me to solve this problem and thank you in advance.
请帮我解决这个问题,并在此先感谢您。 My Flask code:
我的烧瓶代码:
@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()
The message from Heroku:来自 Heroku 的消息:
Heroku creates a git repository with your source code before building and deploying your code. Heroku 在构建和部署代码之前使用您的源代码创建一个 git 存储库。 You had tried to access that private Git repository, which is not accessible to the outside world (therefore, the
Method Not Allowed
error message appeared).您曾尝试访问外部世界无法访问的私有 Git 存储库(因此出现
Method Not Allowed
错误消息)。 But the actual website where your web app is deployed is different.但是部署 Web 应用程序的实际网站是不同的。 That web app includes your app name, if you had given one during Heroku app creation, else a random name is given to your web app.
该 Web 应用程序包含您的应用程序名称,如果您在 Heroku 应用程序创建期间提供了一个,否则会为您的 Web 应用程序提供一个随机名称。
Heroku Git Repository Link: https://git.heroku.com/serene-crag-92322.git Heroku Git 存储库链接: https ://git.heroku.com/serene-crag-92322.git
Deployed Heroku App Link: http://serene-crag-92322.herokuapp.com/部署的 Heroku 应用链接: http ://serene-crag-92322.herokuapp.com/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.