-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathibrowser.py
executable file
·90 lines (61 loc) · 1.72 KB
/
ibrowser.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/python
"""
Web server for the Introgression browser.
Reads config.py to setup.
Uses vcf_walk as shared library and either vcf_walk_ram or vcf_walk_sql as database.
#to add users in the command line run:
#ibrowser adduser <USERNAME> <PASSWORD>
NFO FILE:
title=
custom_order=
custom_order=
custom_order=
CUSTOM ORDER FILE:
#ROWNUM=0 (-1 or nothing to ignore)
#COLNUM=1 (-1 or nothing to ignore)
#NAME=
#CHROMOSOME= (__global__ or empty for all chromosomes)
row order\tcol order\n
"""
#TODO
#https://exploreflask.com/users.html
import sys
print "IMPORTING BEHAVIOUR"
from behaviour import *
def init( args ):
print "initing. args:", args
load_config( args )
def start():
proto = 'http'
if app.config['USE_SSL']:
proto = 'https'
URL = "%s://%s:%d" % ( proto, app.config["SERVER_IP" ], app.config["SERVER_PORT" ] )
cfg = {
'port': app.config["SERVER_PORT"],
'host': app.config["SERVER_IP" ]
}
if app.config['USE_SSL']:
cfg['ssl_context'] = (app.config["SSL_CERT"], app.config["SSL_KEY"])
#app.run(port=app.config["SERVER_PORT" ], host='0.0.0.0', ssl_context=app.config["SSL_CONTEXT"])
if app.config['HAS_LOGIN']:
print 'USING LOGIN',
else:
print 'NOT USING LOGIN',
if app.config['USE_SSL']:
print ": USING SSL ::",
else:
print ": NOT USING SSL ::",
print "ACCESS AT %s" % URL
app.run(**cfg)
if __name__ == '__main__':
init(sys.argv[1:])
if len(sys.argv) > 2:
run_action(sys.argv[2:])
else:
if app.config['HAS_LOGIN' ]:
add_default_users()
load_database()
start()
else:
load_database()
application = app