Files
api2/manage.py
T

27 lines
563 B
Python

from flask.ext.script import Manager, prompt_bool
from api import app, db
from api.models import Designer
manager = Manager(app)
@manager.command
def initdb():
db.create_all()
print("All tables created")
@manager.command
def dropdb():
if prompt_bool("Are you sure you want to lose all your data"):
db.drop_all()
print("All tables dropped")
@manager.command
def seed():
print("Adding sample data")
designer = Designer(name="Martin", path='/martin')
db.session.add(designer)
db.session.commit()
if __name__ == '__main__':
manager.run()