equal
deleted
inserted
replaced
1 from twisted.web import resource, server |
1 from twisted.web import resource, server |
2 from twisted.internet import reactor |
2 from twisted.internet import reactor |
|
3 from twisted.python import log |
|
4 import sys |
3 |
5 |
4 from sqlalchemy import create_engine, pool |
6 from sqlalchemy import create_engine, pool |
5 |
7 |
6 import logging |
8 import logging |
7 |
9 |
8 from .model import setEngine, setPool |
10 from .model import setEngine, setPool |
9 from .controller.pool import startPool, dbPool |
11 from .controller.pool import startPool, dbPool |
10 from .view import xmlrpc |
12 from .view import xmlrpc |
11 import config |
13 from . import config |
|
14 from .install import check, createSampleConfig |
12 |
15 |
13 def runReactor(reactor, engine, port, root): |
16 def runReactor(reactor, engine, port, root): |
14 setEngine(engine) |
17 setEngine(engine) |
15 startPool(reactor) |
18 startPool(reactor) |
16 setPool(dbPool) |
19 setPool(dbPool) |
19 logging.info("Server is running now...") |
22 logging.info("Server is running now...") |
20 reactor.run() |
23 reactor.run() |
21 |
24 |
22 |
25 |
23 if __name__ == '__main__': |
26 if __name__ == '__main__': |
24 |
27 |
|
28 if not check(): |
|
29 createSampleConfig() |
|
30 log.msg("Please edit iro.conf and run %s --install"%sys.argv[0]) |
|
31 |
25 config.readConfig() |
32 config.readConfig() |
26 |
33 |
27 engine = create_engine(config.main.dburl, |
34 engine = create_engine(config.main.dburl, |
28 poolclass = pool.SingletonThreadPool, pool_size=dbPool.maxthreads, ) |
35 poolclass = pool.SingletonThreadPool, pool_size=dbPool.maxthreads, ) |
29 |
36 |