当前位置:   article > 正文

使用flask-script中的Manage管理app程序_manage = manager(app)

manage = manager(app)

 

manage.py文件:

from application import app, db
from flask_apidoc.commands import GenerateApiDoc
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, Server

migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command('apidoc', GenerateApiDoc(input_path="application/api"))
manager.add_command('db', MigrateCommand)
manager.add_command('runserver', Server(port=8080))

if __name__ == "__main__":
    manager.run()

 

生成文档:

python manage.py apidoc

建立数据库:

python manage.py db init

python manage.py db migrate

python manage.py db upgrade

使用命令行启动app:

python manage.py runserver

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/790848
推荐阅读
相关标签
  

闽ICP备14008679号