我正在尝试创建一个巨大的PDF文件(大约300MB),我收到了这个错误:
error at /generar-pdf/7/AoyZ1431Az
[Errno 111] Connection refused
这是完整的错误
这是生成de PDF的视图:
def generar_libro(request, book, order):
try:
book = Book.objects.get(pk=int(book))
order = Order.objects.get(identificador=pedido, cuento=book)
except ObjectDoesNotExist:
raise Http404
file_name = randstring(25)
data = {}
data = ast.literal_eval(order.data)
data['order'] = order
# Render html content through html template with context
template = get_template(order.book.template_html)
html = template.render(Context(data))
# Write PDF to file
fullfilename = os.path.join(settings.MEDIA_ROOT + "/pdfs/", file_name + ".pdf")
fichero = open(fullfilename, "w+b")
pisaStatus = pisa.CreatePDF(html.encode('utf-8'), dest=fichero,
encoding='utf-8')
# Return PDF document through a Django HTTP response
fichero.seek(0)
pdf = fichero.read()
fichero.close() # Don't forget to close the file handle
order.url_pdf = '%s.pdf' % file_name
order.save()
return HttpResponseRedirect(reverse('single', kwargs={'order': order.pk}))
我正在尝试使用另一个仅重25MB的PDF并且它正在运行。所以我认为它可能是重量,任何人都知道一个可行的解决方案?
编辑:我正在使用Apache由于