-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
37 lines (24 loc) · 767 Bytes
/
manage.py
File metadata and controls
37 lines (24 loc) · 767 Bytes
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
import unittest
import os
from flask_cors import CORS
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from app import blueprint
from app.main import create_app, db
app = create_app(os.getenv('API_CONFIG', 'dev'))
CORS(app, resources={r"/api/*": {"origins": "*"}})
app.register_blueprint(blueprint)
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
@manager.command
def test():
tests = unittest.TestLoader().discover('test', pattern='*_tests.py')
result = unittest.TextTestRunner(verbosity=2).run(tests)
if not result.wasSuccessful():
print("Tests failed")
@manager.command
def run():
app.run(host='0.0.0.0')
if __name__ == '__main__':
manager.run()