-
Notifications
You must be signed in to change notification settings - Fork 2
/
manage.py
44 lines (31 loc) · 789 Bytes
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Docker Compose UI, flask based application
"""
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from scripts import app, db
from scripts.models import User
migrate = Migrate(app, db)
manager = Manager(app)
# migrations
manager.add_command('db', MigrateCommand)
@manager.command
def create_db():
"""Creates the db tables."""
db.create_all()
@manager.command
def drop_db():
"""Drops the db tables."""
db.drop_all()
@manager.command
def create_admin():
"""Creates the admin user."""
db.session.add(User(email='[email protected]', password='admin', admin=True))
db.session.commit()
@manager.command
def create_data():
"""Creates sample data."""
pass
# run app
if __name__ == "__main__":
manager.run()