forked from theyosh/TerrariumPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterrariumPI.py
35 lines (30 loc) · 1 KB
/
terrariumPI.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
# -*- coding: utf-8 -*-
from gevent import monkey, sleep
monkey.patch_all()
import os
BASEDIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(BASEDIR)
# https://untangle.readthedocs.io/en/latest/#encoding
try:
# This is python2 only...
import sys
reload(sys) # just to be sure
sys.setdefaultencoding('utf-8')
except Exception as ex:
pass
import terrariumLogging
logger = terrariumLogging.logging.getLogger(__name__)
from terrariumEngine import terrariumEngine
from terrariumWebserver import terrariumWebserver
logger.info('Starting terrariumPI')
if __name__ == "__main__":
logger.debug('Starting terrariumPI engine')
terrariumEngine = terrariumEngine()
logger.debug('Started terrariumPI engine')
logger.debug('Starting terrariumPI webserver')
terrariumWebserver = terrariumWebserver(terrariumEngine)
logger.debug('Started terrariumPI webserver')
terrariumWebserver.start()
logger.info('Stopping terrariumPI')
terrariumEngine.stop()
logger.info('Shutdown terrariumPI done. Bye bye ...')