构建了一个新的 Flask 应用程序——旧的应用程序仍在浏览器中显示

kay*_*yak 6 python flask

我昨天做了以下文件。

# import flask
from flask import Flask
from flask import render_template
from flask import request

app = Flask(__name__)

# create url & function mapping for root or /
@app.route('/')
def index():
    return "Hello from Flask"

# create another mapping name /hello
@app.route('/hello')
def hello():
    myName = "kayak"
    return "Hello again !!" + myName

# create mapping for /myprofile
@app.route('/myprofile')
def showmyprofile():
    return render_template('myprofile.html')

# create mapping for /myprofile
@app.route('/addprofileform')
def addprofileform():
    return render_template('myprofileform.html')

# create a mapping for /addprofile
@app.route('/addprofile')
def addprofile():
    myname = request.args.get('myname')
    state_of_residence = request.args.get('state_of_residence')
    return render_template('myprofile.html', html_page_name=myname,
    html_page_state_of_residence=state_of_residence)

if __name__== '__main__':
    app.run()
Run Code Online (Sandbox Code Playgroud)

然后我今天做了以下文件。

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return 'This is the homepage'

if __name__ == "__main__":
    app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)

我想

app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)

可以清除旧数据,但我没有,并且http://127.0.0.1:5000/页面一直显示“您好,来自 Flask”。

我该如何解决?

Gol*_*kin 1

只需清除浏览器中的缓存并尝试再次运行即可。

以下是在某些浏览器中清除缓存的方法:

Firefix-> https://support.mozilla.org/en-US/kb/how-clear-firefox-cache Chrome-> https://support.google.com/accounts/answer/32050?co=GENIE.Platform %3DDesktop&hl=en