Score:0

Python Flask error "ValueError: malformed url rule"

cn flag

I'm quite new to Python Flask framework and I'm trying to run this code.

from flask import Flask
app = Flask(__name__)

@app.route('/welcome')
def welcome():
        return '<h1>Welcome to Flask</h1>'

@app.route('/hello/<path:/welcome>')
def set_path(path):
        return path

app.debug = True
app.run(host='localhost', port=8080)

But then, when I run the code, I will get an error that says:

"ValueError: malformed url rule: '/hello/path:/welcome'"

I am not too sure of the correct to use the "path" in the decorator as I follow the instruction here. The screenshot (number 4) from the instruction here is the part that I'm confused with. What's the correct way of using it?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.