def handle(self, *args, **kwargs): version_msg = "Current SX Console version: {}".format(version) try: resp = requests.get( 'http://cdn.skylable.com/check/sxconsole-lite-version') except Exception as e: msg = version_msg + ".\nFailed to check for updates. Error: {}." logger.error(msg.format(e)) return if resp.ok: msg = version_msg + ", latest version: {}" logger.info(msg.format(resp.text)) else: msg = version_msg + ". Failed to check for updates ({}). " logger.warn(msg.format(resp.status_code))
def handle(self, *args, **kwargs): from django.conf import settings if not settings.DEMO: return admin, created = Admin.objects.update_or_create( email=settings.DEMO_USER, defaults={ 'level': Admin.LEVELS.ROOT_ADMIN, }) if created: logger.info('Demo user {} has been created'.format(admin.email)) if not admin.check_password(settings.DEMO_PASS): admin.set_password(settings.DEMO_PASS) admin.save()