标签:shel man query 服务 __name__ 语句 style col color
#coding=utf-8 #Flask-Script是一个可以在flask应用外部编写脚本的扩展 #常用功能: #运行一个开发的服务器 #python shell中操作数据库看 #命令行任务 #from flask_script import Manager #执行语句 python manage.py save from flask_script import Manager from app import app, db from models import User manager = Manager(app) @manager.command def hello(): print "hello world" @manager.command def save(): user = User(5, "zilazd") db.session.add(user) db.session.commit() @manager.command def query(): users = User.query_all() for u in users: print u if __name__ == "__main__": manager.run()
标签:shel man query 服务 __name__ 语句 style col color
原文地址:https://www.cnblogs.com/themost/p/8926104.html