always return the same pdf
Gonzalo V
gvm2121 at gmail.com
Mon Mar 7 09:08:59 EST 2022
Hello everyone.
i had upload a Django app to an ubuntu 18.04 server and it gives me the
same pdf everytime the view is called. To generate the pdf it receipts
differents string buy it gives me the same pdf. Could you give some idea
what is happening?
thanks everyone
@never_cached
def generar_pdf(request):
prueba = request.session.get('contenedor')
cantidad_preguntas=prueba['cantidad_preguntas']
archivo_salida = open("prueba.tex","w")
archivo_salida.write("\\documentclass[10pt,oneside,letterpaper]{article}")
archivo_salida.write("\\usepackage[utf8x]{inputenc}")
##hace mas y mas cosas sin importancia con latex que funcionan bien
archivo_a_descargar = open("prueba.pdf","rb") #
respuesta =
HttpResponse(archivo_a_descargar,content_type='application/pdf')
respuesta['Content-Disposition'] = 'attachment; filename="{0}"'.format(
archivo_a_descargar.name)
return respuesta
Saludos,
Gonzalo
More information about the Python-list
mailing list