我在我的 django 项目中运行以下代码,在 localhost 上运行良好
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
filepath = BASE_DIR + '/polls/static/polls/DejaVuSansCondensed.ttf'
pdf.add_font('DejaVu', '', filepath, uni=True)
pdf.set_font("DejaVu", size = 20)
pdf.multi_cell(190,10,"Some nice text",0,0)
test_string = pdf.output(dest = 's').encode('latin-1')
pdf.output
在为 Azure 应用服务上传后,代码在最后一行出现故障,出现以下错误:[Errno 2] No such file or directory: 'polls\\static\\polls\\DejaVuSansCondensed.ttf'