forked from 0x2620/pandora
fix ./manage.py orphaned_media
This commit is contained in:
parent
3064785b3e
commit
4b575c2c89
1 changed files with 4 additions and 3 deletions
|
@ -4,17 +4,18 @@ from django.core.management.base import BaseCommand
|
|||
from django.conf import settings
|
||||
import os
|
||||
from glob import glob
|
||||
from ... import models
|
||||
|
||||
import app.monkey_patch
|
||||
from ... import models
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
"""
|
||||
help = 'list files no longer without db entry'
|
||||
help = 'list files without db entry'
|
||||
args = ''
|
||||
|
||||
def handle(self, **options):
|
||||
for f in glob(os.path.join(settings.MEDIA_ROOT, 'files', '*', '*', '*', '*')):
|
||||
for f in glob(os.path.join(settings.MEDIA_ROOT, 'media', '*', '*', '*', '*')):
|
||||
oshash = f[-19:].replace('/', '')
|
||||
if models.File.objects.filter(oshash=oshash).count() == 0:
|
||||
print f
|
Loading…
Reference in a new issue