# coding=utf-8 from __future__ import print_function from __future__ import print_function import os import django import sys sys.path.append("/var/www/projects/lms/") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings") django.setup() from storage.models import Storage, CroppedImage errors = [] for store in Storage.objects.all(): # Проверить original, f_format.icon obj = (store.original.path if store.original else '', store.f_format.icon.path if store.f_format and store.f_format.icon else '') for i in obj: if i and not os.path.exists(i): print('Storage: {0}'.format(store.id)) #print 'Ошибки файлов: {0}'.format(len(errors)) for store in CroppedImage.objects.all(): # croppedimage.big, croppedimage.middle, croppedimage.small obj = (store.big.path if store.big else '', store.middle.path if store.middle else '', store.small.path if store.small else '') for i in obj: if i and not os.path.exists(i): print('CroppedImage: {0}'.format(store.id)) #print 'Ошибки файлов: {0}'.format(len(errors))