forked from theyosh/TerrariumPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
terrariumPI.py
37 lines (32 loc) · 1.08 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
36
37
# -*- coding: utf-8 -*-
from gevent import monkey, sleep
monkey.patch_all()
# 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
'''
Install extra modules:
aptitude install python-dateutil python-ow python-rpi.gpio python-psutil python-pip
pip install gevent untangle uptime bottle bottle_websocket
'''
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')