forked from 0x2620/pandora
orphan files, fix vm build
This commit is contained in:
parent
4d113c80c6
commit
00145a603b
2 changed files with 21 additions and 1 deletions
20
pandora/archive/management/commands/orphan_files.py
Normal file
20
pandora/archive/management/commands/orphan_files.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
import os
|
||||
from glob import glob
|
||||
from ... import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
"""
|
||||
help = 'list files no longer without db entry'
|
||||
args = ''
|
||||
|
||||
def handle(self, **options):
|
||||
for f in glob(os.path.join(settings.MEDIA_ROOT, 'files', '*', '*', '*', '*')):
|
||||
oshash = f[-19:].replace('/', '')
|
||||
if models.File.objects.filter(oshash=oshash).count() == 0:
|
||||
print f
|
|
@ -42,10 +42,10 @@ cd /srv/pandora/pandora
|
|||
sudo -u pandora python manage.py syncdb --noinput
|
||||
echo "UPDATE django_site SET domain = 'pandora.local', name = 'pandora.local' WHERE 1=1;" | sudo -u pandora python manage.py dbshell
|
||||
|
||||
sudo -u pandora python manage.py update_static
|
||||
|
||||
mkdir /srv/pandora/data
|
||||
chown -R pandora:pandora /srv/pandora
|
||||
sudo -u pandora python manage.py update_static
|
||||
|
||||
cp /srv/pandora/etc/init/* /etc/init/
|
||||
|
||||
|
|
Loading…
Reference in a new issue