该网站无法提供安全的连接(heroku)

时间:2020-08-05 14:20:02

标签: python google-chrome ssl flask server

尝试了所有步骤:https://www.ssl2buy.com/wiki/how-to-fix-err-ssl-protocol-error

Error

确切代码: 来自https://techwithtim.net/tutorials/flask/a-basic-website/

from flask import Flask

# Defining the home page of our site
app = Flask(__name__)

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

@app.route("/")  # this sets the route to this page
def home():
    return "Hello! this is the main page <h1>HELLO</h1>"  # some basic inline html@app.route("/")  # this sets the route to this page

1 个答案:

答案 0 :(得分:0)

代码顺序错误。应在运行应用程序之前定义所有页面/路由(app.run())。我认为网站上的视频比您链接的网站更能说明问题。

此问题与Heroku无关,因此我建议将其从标题中删除。

from flask import Flask

# Defining the home page of our site
app = Flask(__name__)

@app.route("/")  # this sets the route to this page
def home():
    return "Hello! this is the main page <h1>HELLO</h1>"

#moved this below @app.route
if __name__ == "__main__":
    app.run()