author | cavaliet |
Thu, 09 Oct 2014 11:48:42 +0200 | |
changeset 3 | 1b94e6e9579f |
parent 2 | fc1ab0074e29 |
child 13 | 435d5c15275a |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
# |
|
3 |
# See LICENCE for detail |
|
4 |
# Copyright (c) 2014 IRI |
|
5 |
# |
|
6 |
||
2
fc1ab0074e29
export config in config file + add static file
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
7 |
import os.path |
0 | 8 |
import sys |
9 |
||
10 |
import psycopg2.extras |
|
11 |
||
12 |
from twisted.application import service |
|
13 |
from twisted.python import log |
|
14 |
from txpostgres import txpostgres |
|
15 |
||
16 |
from annotserver import make_service |
|
3 | 17 |
from config import config |
0 | 18 |
from models import get_table_create_stmt |
19 |
from utils import create_connection_pool |
|
20 |
||
21 |
||
22 |
psycopg2.extras.register_uuid() |
|
23 |
||
24 |
||
25 |
conn, d = create_connection_pool(config['conn_str']) |
|
26 |
#to do treat error |
|
27 |
d.addCallback(lambda _: conn.runOperation(get_table_create_stmt())) |
|
28 |
||
29 |
#TOODO Log |
|
30 |
#log.startLogging(sys.stdout) |
|
31 |
||
32 |
||
33 |
application = service.Application("annot-server") |
|
34 |
||
35 |
annotserver = make_service(config, conn) |
|
36 |
annotserver.setServiceParent(service.IServiceCollection(application)) |