I'm new to flask and python. For example, if you have the following code...
@app.route('/')
def index():
return "Hello world!"
@app.route('/accounts')
def accounts():
return some_data
@app.route('/login')
def login():
return render_template(login.html)
if __name__ == "__main__":
app.run()
In what order will these execute? From what I understand if you are on the /accounts page of the website, that function will run. If you are on the /login page, that function will run. What role does the parameter for the route method play? Secondly, how many times will the last two lines of code be run (will the app.run() be called once or every time the app.route() is called)? Additionally, what folder should an app be put in within a filestructure for a website?
Aucun commentaire:
Enregistrer un commentaire