Py学习  »  Python

如何在Pythonanywhere中安装django wkhtmltopf。?

Mike_Wazowski • 4 年前 • 576 次点击  

如何安装 django wkhtmltopdf格式 在里面 蟒蛇 .?

当我尝试安装时 第三点 . 已经很满足了 当我运行项目时 服务器错误(500)

Bash控制台

Requirement already satisfied: django-wkhtmltopdf in ./.local/lib/python3.7/site-packages (3.2.0)

服务器错误日志

FileNotFoundError: [Errno 2] No such file or directory: 'wkhtmltopdf': 'wkhtmltopdf'

wkhtmltopfd可以安装在Pythonanywhere上吗?

当我选择一个AWS服务器时,我会面临类似的问题吗?AWS是否支持wkhtmltopdf。?

如何解决这个问题。?我的整个项目依赖于PDF报告

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/51218
 
576 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Vikas Gautam
Reply   •   1 楼
Vikas Gautam    4 年前

我不确定pythonanywhere,但在windows中,我下载了wkhtmltox.zip,在其中,我发现 wkhtmltox.exe . 您还需要安装 wkhtmltox .

import imgkit
config_img = imgkit.config(wkhtmltoimage='../path_of_wkhtmltopdf/wkhtmltox.exe')  #in windows
config_img = imgkit.config(wkhtmltoimage='../path_of_wkhtmltopdf/wkhtmltox')   #in linux
imgkit.from_string(html, file_path + '.jpg', config=config_img) 

对于蟒蛇

上传 wkhtmltox公司 文件从上载选项存在于 file 剖面图 pythonanywhere .

检查当前目录并列出该目录中的文件,然后找到您的文件。

import os
print(os.getcwd())                   # current directory path

print(os.listdir(os.getcwd())        # list files present in current directory