# coding=utf-8 import sys import os from base import init_env env = sys.argv[1] os.environ.setdefault('DJANGO_SETTINGS_MODULE', env) init_env(interactive=False) from apps.web.device.models import Device def charge_other_config(logicalCode): device = Device.objects.filter(logicalCode=logicalCode).first() if not device: print "device not exists" return otherConf = device.otherConf otherConf.update({"consumeModule": 1}) device.update(otherConf=otherConf) Device.invalid_device_cache(device.devNo) print "ok" if __name__ == '__main__': charge_other_config(sys.argv[2])