简体   繁体   中英

Python Flask Calling Functions

Is it possible within the html template to call a python function? for example:

Call a function to check for a word within an input on the keypress event?

Thanks

You are able to call function in Flask, yes

for example:

def say_smt():
  print("hey")

@app.route('/')
def site():
  say_smt()

however using an input() would initiate a break in the whole script, so it would crash the whole Flask Server so that's not possible. Please be more specific about what your goal is

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM