first commit

This commit is contained in:
Martin
2016-04-18 20:56:24 +02:00
commit ae3a566f68
13 changed files with 195 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
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 %s' % db.engine.url
designer = Designer(name="Martin", path='/martin', username='martin', password='secret')
db.session.add(designer)
db.session.commit()
if __name__ == '__main__':
manager.run()