manage.py 383 B

12345678910111213141516171819202122
  1. from flask.cli import FlaskGroup
  2. from project import create_app
  3. from project.models import create_db, reset_db, migrate
  4. app = create_app()
  5. cli = FlaskGroup(app)
  6. @cli.command("create_db")
  7. def set_up_db():
  8. with app.app_context():
  9. create_db()
  10. @cli.command("reset_db")
  11. def resetdb():
  12. with app.app_context():
  13. reset_db()
  14. if __name__ == "__main__":
  15. cli()