0

I was messing around with learning python myself, was working on a little HTML website using python. Anyone could please explain the differences between the two applications below?

When it's written like this it doesn't work. (this is an example I got from the top result from google)

@app.route('/index')
def index():
    return render_template('index.html')

doesn't works

but when I include the full link .html

@app.route('/index.html')
def index():
    return render_template('index.html')

it works?

4

1 回答 1

0

好的,假设您有 index.html 和 index.png 您的代码不知道需要什么文件。即使您只有一个文件,阻止您的代码打开其他文件也是一种安全。文件扩展名是文件的一部分。

于 2021-10-24T08:49:14.590 回答