flask - 如何使用邮递员通过烧瓶 apscheduler api 添加作业
问题描述
from flask import Flask
from flask_apscheduler import APScheduler
class Config(object):
JOBS = [
{
'id': 'job5',
'func': 'f_s_api.view:job1',
'trigger': 'interval',
'seconds': 50
}
]
SCHEDULER_API_ENABLED = True
def job1():
print('job add')
if __name__ == '__main__':
app = Flask(__name__)
app.config.from_object(Config())
scheduler = APScheduler()
scheduler.init_app(app)
scheduler.start()
app.run(debug= True , port= 8080)
输出
Serving Flask app “view”(延迟加载)
环境:生产
警告:这是一个开发服务器。不要在生产部署中使用它。
请改用生产 WSGI 服务器。
调试模式:在http://127.0.0.1:8080/
上
运行(按 CTRL+C 退出)
使用 stat 重新启动
调试器处于活动状态!
调试器 PIN:135-565-985
job add
ob add
解决方案
推荐阅读
- node.js - 如何解决 npm 错误“npm ERR!代码生命周期”
- 3d - 3D 中 LibGDX 附近的矩形呈现块状/错误
- linux - ldd & 共享对象错误 Linux - 如何排除故障?
- python - 如何在带有opencv4的Google colab中使用SIFT和SURF算法?
- ansible - 无论如何,Ansible 变量跳过
- ruby-on-rails - 运行命令rails服务器时无法访问mac上的本地rails主机
- php - Laravel - 文件上传按钮在实时服务器中不起作用
- postgresql - docker-compose:致命:用户“postgres”的密码验证失败
- java - 自动建议组合框
- variables - 具有一些特殊值的变量的术语是什么