try: app.driver = driver.RouterDriver("/dev/ttyAMA0", app.software_only) app.driver.open() except I2CIOError: print print "Cannot open I2C interface to a router board." print print_software_only_notice() sys.exit(-1) except SerialIOError: print print "Cannot open serial interface to a router board." print print_software_only_notice() sys.exit(-1) logging.info("Found %d dispensers." % app.driver.count()) app.options = load_options() app.mixer = mixer.Mixer(app.driver, app.mc) if app.software_only: logging.info( "Running SOFTWARE ONLY VERSION. No communication between software and hardware chain will happen!" ) logging.info("Bartendro starting") app.debug = args.debug if __name__ == '__main__': app.run(host=args.host, port=args.port)
debug = False try: app.software_only = int(os.environ['BARTENDRO_SOFTWARE_ONLY']) app.num_dispensers = 15 except KeyError: app.software_only = 0 # Create a memcache connection and flush everything app.mc = memcache.Client(['127.0.0.1:11211'], debug=0) app.mc.flush_all() app.log = logging.getLogger('bartendro') app.driver = driver.RouterDriver("/dev/ttyAMA0", app.software_only, mini_router) app.driver.open() app.log.info("Found %d dispensers." % app.driver.count()) app.mixer = mixer.Mixer(app.driver, app.mc, liquid_out) if app.software_only: app.log.info( "Running SOFTWARE ONLY VERSION. No communication between software and hardware chain will happen!" ) app.log.info("Bartendro starting") app.debug = debug app.run(host='0.0.0.0', port=8080)