def handle(self, *args, **options): cwd = os.getcwd() logger.info("Backing up settings from every involved module to %s" % cwd) shutil.copyfile(paths.x10_plugin_settings(), os.path.join(cwd, "x10_plugin_settings.bak")) logger.info("Backed up file: %s" % os.path.join(cwd, "x10_plugin_settings.bak")) shutil.copyfile(paths.django_thermostat_settings(), os.path.join(cwd, "django_thermostat_settings.bak")) logger.info("Backed up file: %s" % os.path.join(cwd, "django_thermostat_settings.bak"))
def handle(self, *args, **options): #logging.basicConfig(level=logging.DEBUG) self.gen_settings() self.apply_settings(self.database()) self.apply_settings(self.server()) self.apply_settings(self.time_zone()) self.apply_settings(self.statics()) while True: harest = raw_input("Want to deploy the Home Automation Python Project REST API server (module django_hautomation)? Yes|No: ") if harest not in ("No", "Yes"): self.stderr.write("Answer not valid. Yes or No?") continue harest = (harest == "Yes") break if harest: self.apply_settings( self.x10_plugin(), self.HAUTOMATION_X10_PATH, paths.x10_plugin_settings()) #marking as activated the django_hautomation module self.apply_settings({"HA_DJANGO_HAUTOMATION_DEPLOYED": harest}) while True: haweb = raw_input("Want to deploy the Home Automation Python Project Domotic Web (module django_haweb)? Yes|No: ") if haweb not in ("No", "Yes"): self.stderr.write("Answer not valid. Yes or No?") continue haweb = (haweb == "Yes") break if haweb: self.apply_settings(self.ha_web()) self.apply_settings({"HA_DJANGO_HAWEB_DEPLOYED": haweb}) while True: hathermometer = raw_input("Want to deploy the Home Automation Python Project Thermometer (module django_thermometer)? Yes|No: ") if hathermometer not in ("No", "Yes"): self.stderr.write("Answer not valid. Yes or No?") continue hathermometer = (hathermometer == "Yes") break if hathermometer: self.django_thermometer() self.apply_settings({"HA_DJANGO_THERMOMETER_DEPLOYED": hathermometer}) while True: hathermostat = raw_input("Want to deploy the Home Automation Python Project Thermostat (module django_thermostat)? Yes|No: ") if hathermostat not in ("No", "Yes"): self.stderr.write("Answer not valid. Yes or No?") continue hathermostat = (hathermostat == "Yes") break if hathermostat: self.apply_settings( self.django_thermostat(), self.THERMOSTAT_PATH, paths.django_thermostat_settings() ) self.apply_settings({"HA_DJANGO_THERMOSTAT_DEPLOYED": hathermostat}) supervisor = self.supervisor() self.apply_settings(supervisor, self.SUPERVISOR_EVAL_HASUITE_THERM_PATH, self.SUPERVISOR_EVAL_HASUITE_THERM_PATH_DEST) self.apply_settings(supervisor, self.SUPERVISOR_HASUITE_PATH, self.SUPERVISOR_HASUITE_PATH_DEST)