我想运行html网页在那里我用一个按钮来设置一个特定的时间(见下文),它后来的运行的一个定时任务,通过该模块 烧瓶务. 我如何可以使用 minute
, hour
, day
, month
外面 def get_time()
没有设置的变量的全球?
什么一个坚实的方式使用烧瓶务在这里?
APP = Flask(__name__)
Bootstrap(APP)
crontab = Crontab(APP)
...
@APP.route('/randompage.html' methods = ['POST', 'GET])
def get_time():
time_req = request.args.get("html_time")
format_time = datetime.strptime(time_req, "%Y-%m-%dT%H:%M")
minute = format_time.minute
hour = format_time.hour
day = format_time.day
month = fomrat_time.month
return render_template('randompage.html', time_req=time_req)
@crontab.job()
def exe_control():
do something here
按钮在html网页:
<form action="/randompage.html" method="GET">
<input type="datetime-local" name="html_time"/>
<input type="submit"/></form>