到目前为止,这是我从另一篇文章改编的代码。
import socket
print(socket.gethostbyname(socket.getfqdn(socket.gethostname())))
from flask import request
from flask import jsonify
from flask import Flask
app = Flask(__name__)
@app.route("/sample")
def hello():
return "This works"
import threading
threading.Thread(target=app.run, kwargs={'host':'0.0.0.0','port':80}).start()
即使我能够从http://172.28.0.2/sample访问该网页,也无法访问它。