-
Notifications
You must be signed in to change notification settings - Fork 1
/
manage.py
51 lines (40 loc) · 1.56 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
import sys
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from manage import core, web
from argos.web import api
from flask import request
if __name__ == '__main__':
# Get the command to determine the app config.
if 'evaluate' in sys.argv[1]:
config = {
'SQLALCHEMY_DATABASE_URI': 'postgresql://argos_user:password@localhost:5432/argos_eval'
}
app = api.create_app(**config)
else:
app = api.create_app()
# For debugging...
@app.before_request
def log_request():
print(request.url)
print(request.headers)
manager = Manager(app)
# Web
manager.add_command('create:client', web.CreateClientCommand())
manager.add_command('create:admin', web.CreateAdminCommand())
# Core
manager.add_command('create:sources', core.CreateSourcesCommand())
manager.add_command('seed', core.SeedCommand())
manager.add_command('recluster', core.ReclusterCommand())
manager.add_command('train', core.TrainVectorizerCommand())
manager.add_command('stats', core.GutcheckCommand())
manager.add_command('preview:events', core.PreviewEventsCommand())
manager.add_command('load:corpora', core.LoadCorporaCommand())
manager.add_command('check:gaps', core.CheckTimeGapsCommand())
# Evaluation
manager.add_command('profile', core.ProfileCommand())
# Misc
manager.add_command('db', MigrateCommand)
manager.add_command('shell', Shell())
manager.add_command('server', Server(host='0.0.0.0'))
manager.run()