मैं करना चाहते हैं चलाने के लिए एक html पृष्ठ जहाँ मैं एक बटन का उपयोग करने के लिए एक विशिष्ट समय सेट (नीचे देखें), जो बाद में चलाता है एक cronjob के माध्यम से मॉड्यूल फ्लास्क-crontab. कैसे मैं उपयोग कर सकते हैं minute
, hour
, day
, month
बाहर def get_time()
बिना सेटिंग चर वैश्विक?
क्या एक ठोस तरीका का उपयोग करने के लिए फ्लास्क-crontab यहाँ?
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>