赞
踩
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。