【发布时间】:2020-05-24 21:43:10
【问题描述】:
我正在尝试使用 Wit.ai 制作一个聊天机器人。为此,我需要一个 webhook。我正在使用 ngrok,这只是一个测试文件,但我收到了这个错误。
这是我遇到的错误。
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
Traceback (most recent call last):
File "app.py", line 56, in <module>
app.run(debug = True, port = 80)
File "/home/parth/.local/lib/python3.6/site-packages/flask/app.py", line 990, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 988, in run_simple
s.bind(server_address)
PermissionError: [Errno 13] Permission denied
这是代码
import os, sys
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def verify():
# Webhook verification
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"):
if not request.args.get("hub.verify_token") == "hello":
return "Verification token mismatch", 403
return request.args["hub.challenge"], 200
return "Hello world", 200
if __name__ == "__main__":
app.run(debug = True, port = 80)
谢谢!
【问题讨论】:
-
你测试在 5000 端口上运行了吗?
-
成功了!谢谢,我不知道。