-
Notifications
You must be signed in to change notification settings - Fork 17
/
launch.py
46 lines (40 loc) · 1.14 KB
/
launch.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
# copy almost all of pando.__main__ to set the www_root
import os
import logging.config
from wsgiref.simple_server import make_server
from pando import website
from pando.logging import log_dammit
logging_cfg = {
'version': 1,
'formatters': {
'threadinfo': {
'format':
"%(asctime)s pid-%(process)d thread-%(thread)d "
"(%(threadName)s) %(levelname)s: %(message)s",
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'threadinfo',
'level': 'INFO',
'stream': 'ext://sys.stderr',
},
},
'root': {
'handlers': ['console'],
},
}
if __name__ == '__main__':
logging.config.dictConfig(logging_cfg)
port = int(os.environ.get('PORT', '8080'))
host = os.environ.get('PANDO_HOST', '0.0.0.0')
log_dammit(
"Greetings, program! Now serving on http://{0}:{1}/."
.format(host, port))
website = website.Website(
www_root='www',
renderer_default='jinja2',
project_root='.',
)
make_server(host, port, website).serve_forever()