-
Notifications
You must be signed in to change notification settings - Fork 4
/
manage.py
62 lines (46 loc) · 1.5 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import sys
import importlib
import os
import time
from work_muxixyz_app import create_app, db
from work_muxixyz_app.models import Team,Group,User,Project,Message,Statu,File,Comment,Doc
from work_muxixyz_app.models import Feed
from flask_script import Manager,Shell,Command
from flask_migrate import Migrate,MigrateCommand
from sqlalchemy import func
app=create_app(os.getenv('FLASK_CONFIG') or 'default')
manager=Manager(app)
migrate=Migrate(app,db)
manager.add_command('db',MigrateCommand)
MQHOST = os.getenv('MQHOST') or '120.78.194.125'
MQUSERNAME = os.getenv("MQUSERNAME")
MQPASSWORD = os.getenv("MQPASSWORD")
def make_shell_context():
return dict(app=app)
manager.add_command("shell",Shell(make_context=make_shell_context))
@manager.command
def test_management():
import unittest
tests=unittest.TestLoader().discover('test_management')
unittest.TextTestRunner(verbosity=2).run(tests)
@manager.command
def test_project():
import unittest
tests=unittest.TestLoader().discover('test_project')
unittest.TextTestRunner(verbosity=2).run(tests)
@manager.command
def test_status():
import unittest
tests = unittest.TestLoader().discover('test_status')
unittest.TextTestRunner(verbosity=2).run(tests)
@manager.command
def test_message():
import unittest
tests=unittest.TestLoader().discover('test_message')
unittest.TextTestRunner(verbosity=2).run(tests)
@manager.command
def createdb():
db.create_all()
if __name__=='__main__':
manager.run()
app.run(debug=True)