-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
62 lines (54 loc) · 1.3 KB
/
run.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
#!/usr/bin/env python
# coding: utf-8
import bottle
import logging
from devmine import Devmine
from devmine.config import (
environment,
settings
)
def main():
logging.basicConfig(
filename="devmine/log/" + settings.environment + ".log",
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s")
logging.info('Devmine server started')
db_url = settings.db_url
server = settings.server
if not db_url:
db_url = environment.db_url
if not server:
server = environment.server
logging.info(
'\nServer settings:\n'
'server = %s\n'
'host = %s\n'
'port = %s\n'
'db_url = %s\n'
'db_echo = %s\n'
'reloader = %s\n'
'debug = %s\n',
server,
settings.host,
settings.port,
db_url,
environment.db_echo,
environment.reloader,
environment.debug)
a = Devmine(
server=server,
host=settings.host,
port=settings.port,
db_url=db_url,
db_echo=environment.db_echo,
reloader=environment.reloader,
debug=environment.debug
)
bottle.run(
a.app,
server=a.server_type,
reloader=a.reloader,
host=a.host,
port=a.port
)
if __name__ == "__main__":
main()