-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
36 lines (28 loc) · 786 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
import os
import unittest
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from flask_cors import CORS
from app.main import create_app
from app import blueprint
app = create_app(os.environ.get('DEVELOPMENT_MODE') or 'dev')
app.register_blueprint(blueprint)
CORS(app)
app.app_context().push()
manager = Manager(app)
# Db initialization
# migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
@manager.command
def run():
app.run()
@manager.command
def test():
# Runs the unit test
tests = unittest.TestLoader().discover('app/tests', pattern='test*.py')
result = unittest.TextTestRunner(verbosity=2).run(tests)
if result.wasSuccessful():
return 0
return 1
if __name__ == '__main__':
manager.run()