Persano commited on
Commit
0aeb759
·
verified ·
1 Parent(s): 8eb2cc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -147,6 +147,11 @@ def download_pdf():
147
  acoes_ret=acoes_ret,
148
  renda_fixa=renda_fixa,
149
  inflacao=inflacao)
 
 
 
 
 
150
  pdf = HTML(string=html_content).write_pdf()
151
 
152
  response = make_response(pdf)
@@ -154,7 +159,10 @@ def download_pdf():
154
  response.headers['Content-Disposition'] = 'attachment; filename=relatorio_simulacao.pdf'
155
  return response
156
  except Exception as e:
157
- return f"Erro: {e}"
 
 
 
158
 
159
  if __name__ == '__main__':
160
  app.run(host='0.0.0.0', port=7860, debug=True)
 
147
  acoes_ret=acoes_ret,
148
  renda_fixa=renda_fixa,
149
  inflacao=inflacao)
150
+
151
+ # Salvar HTML para debug local
152
+ with open("debug_relatorio.html", "w", encoding="utf-8") as f:
153
+ f.write(html_content)
154
+
155
  pdf = HTML(string=html_content).write_pdf()
156
 
157
  response = make_response(pdf)
 
159
  response.headers['Content-Disposition'] = 'attachment; filename=relatorio_simulacao.pdf'
160
  return response
161
  except Exception as e:
162
+ import traceback
163
+ tb = traceback.format_exc()
164
+ return f"Erro: {e}\n\n{tb}"
165
+
166
 
167
  if __name__ == '__main__':
168
  app.run(host='0.0.0.0', port=7860, debug=True)