mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-25 18:58:19 +00:00
Initial commit
This commit is contained in:
18
spa/management/commands/azure_util.py
Executable file
18
spa/management/commands/azure_util.py
Executable file
@@ -0,0 +1,18 @@
|
||||
from django.core.management.base import NoArgsCommand
|
||||
|
||||
from core.utils.cdn import upload_to_azure
|
||||
from spa.models import Mix
|
||||
|
||||
|
||||
class Command(NoArgsCommand):
|
||||
def handle_noargs(self, **options):
|
||||
try:
|
||||
mixes = Mix.objects.filter(archive_updated=False)
|
||||
for mix in mixes:
|
||||
blob_name, download_name = mix.get_cdn_details()
|
||||
upload_to_azure(blob_name, download_name)
|
||||
mix.archive_updated = True
|
||||
mix.save()
|
||||
|
||||
except Exception, ex:
|
||||
print "Fatal error, bailing. {0}".format(ex.message)
|
||||
Reference in New Issue
Block a user