-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
39 lines (35 loc) · 909 Bytes
/
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
from rcj_soccer import application
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
if __name__ == "__main__":
host = "0.0.0.0"
port = 5000
server_fn = type(application).run
arguments = {
"host": host,
"port": port
}
logger.info("Starting app...")
try:
import waitress
server_fn = waitress.serve
logger.info("Using waitress")
arguments["threads"] = 8
except ImportError:
pass
try:
import sanic
server_fn = sanic.Sanic.run
logger.info("Using sanic")
arguments["workers"] = 8
except ImportError:
pass
try:
import bjoern
server_fn = bjoern.run
logger.info("Using bjoern")
except ImportError:
pass
server_fn(application, **arguments)
logger.warn("Running run.py with name: ", __name__)