dianchuanOtherConf.py 628 B

12345678910111213141516171819202122232425262728293031
  1. # coding=utf-8
  2. import sys
  3. import os
  4. from base import init_env
  5. env = sys.argv[1]
  6. os.environ.setdefault('DJANGO_SETTINGS_MODULE', env)
  7. init_env(interactive=False)
  8. from apps.web.device.models import Device
  9. def charge_other_config(logicalCode):
  10. device = Device.objects.filter(logicalCode=logicalCode).first()
  11. if not device:
  12. print "device not exists"
  13. return
  14. otherConf = device.otherConf
  15. otherConf.update({"consumeModule": 1})
  16. device.update(otherConf=otherConf)
  17. Device.invalid_device_cache(device.devNo)
  18. print "ok"
  19. if __name__ == '__main__':
  20. charge_other_config(sys.argv[2])