def buildTestServer(track_gpio_calls = False, gpioFactory=None):
    if gpioFactory == None:
        gpioFactory = GPIOTestFactory(track_gpio_calls = track_gpio_calls) 
    hardware = HouseOfPi(gpioFactory)
    testApp = Server(__name__, hardware)
    
    testApp.config['TESTING'] = True
    testApp.config['LIVESERVER_PORT'] = 8945
    testApp.config['MY_HOUSE_URL'] = 'http://127.0.0.1:3333'
    
    initRoutes(testApp)
    
    return testApp
Esempio n. 2
0
#!env/bin/python
import os
from app.server.server import Server
from app.server.api import initRoutes
from app.hardware.house_of_pi import HouseOfPi
from app.hardware.gpio_factory import GPIOFactory

debugOn = os.environ.get('PYTHON_DEBUG_ON')

gpioFactory = GPIOFactory()
hardware = HouseOfPi(gpioFactory)
app = Server(__name__, hardware)

app.config.update(dict(
    MY_HOUSE_URL='https://poorknight.com'
))

initRoutes(app)

if debugOn != None and (debugOn.lower() == 'true' or debugOn.lower() == 'yes'):
    app.run(debug=True, host='0.0.0.0')
else:
    app.run(debug=False, host='0.0.0.0')