for b in books]
result = create_zip.delay(paths,
getattr(settings, "ALL_%s_ZIP" % format_.upper()))
+ return result.wait()
def zip_audiobooks(self):
bm = BookMedia.objects.filter(book=self, type='mp3')
def download_zip(request, format, slug):
url = None
- if format == 'pdf':
- url = models.Book.zip_pdf()
- elif format == 'epub':
- url = models.Book.zip_epub()
- elif format == 'mobi':
- url = models.Book.zip_mobi()
+ if format in ('pdf', 'epub', 'mobi'):
+ url = models.Book.zip_format(format)
elif format == 'audiobook' and slug is not None:
book = models.Book.objects.get(slug=slug)
url = book.zip_audiobooks()
print '>>> restart webserver'
run('touch %(path)s/%(project_name)s.wsgi' % env)
print '>>> restart Celery'
- sudo('supervisorctl restart celery.%(project_name)s' % env)
+ sudo('supervisorctl restart celery.%(project_name)s:' % env)