-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
37 lines (28 loc) · 1004 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
#!/usr/bin/python
# Author: Brad Sickler
# Description: A boilerplate for a super simple REST API implementation
# Derived from: https://www.freecodecamp.org/news/structuring-a-flask-restplus-web-service-for-production-builds-c2ec676de563/#project-setup-and-organization
import os
import unittest
# from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager # , Command, Option
from app import application
# The manager handles command line options in this case
manager = Manager(application)
HOST = "127.0.0.1"
PORT = 10028
# migrate = Migrate(app, db)
# manager.add_command('db', MigrateCommand)
@manager.command
def run():
application.run(host=HOST, port=PORT)
@manager.command
def test():
"""Runs the unit tests."""
tests = unittest.TestLoader().discover('app/test', pattern='test*.py')
result = unittest.TextTestRunner(verbosity=2).run(tests)
if result.wasSuccessful():
return 0
return 1
if __name__ == '__main__':
manager.run()