Reputation: 41
I am converting an HTML to pdf in django function, for this i am using xhtml2pdf pisa module, and the code is
pdf = pisa.CreatePDF(html, file(settings.MEDIA_ROOT+'/tickets_pdf/'+pdfName, "w"))
This code is working and generates pdf but sometime it works and sometime it doesn't work and give error
No handlers could be found for logger “xhtml2pdf”
There is also same question on SO that I have already checked.
No handlers could be found for logger "xhtml2pdf"
But it did not work for me. If my client generates 10 times pdf then at least 4 times it gives this error and in other case it works fine. Is there any solution for this, or i have to generate pdf in other way.
Upvotes: 1
Views: 796
Reputation: 733
The only solution is to define a handler for xhtml2pdf in your settings file, as suggested by provided link.
The reason you get 500 error is because you have defined logger wrong. Check the app logs for errors, check the path to the log file that you have defined in settings.
Upvotes: 1