Django 尝试运行wkhtmltopdf时,错误13权限被拒绝
也有类似的问题,但我的配置集不是 相同。我从wkhtmltopdf.org下载了wkhtmltopdf,放在 项目文件夹,我不明白为什么我仍然被拒绝访问 试图指示django运行wkhtmltopdf以生成pdf文件 使用UNICORN运行NGINX 使用主管 Ubuntu 16 在我的unicorn_主管日志中,我得到: wkhtmltopdf文件: 独角兽工艺: NGINX工艺 为什么我被拒绝访问,因为wkhtmltopdf文件所有者是同一个运行的unicorn 我可以在终端中运行该命令,但python无法运行它。为什么?只要使用 获取权限 或 sudo命令Django 尝试运行wkhtmltopdf时,错误13权限被拒绝,django,ubuntu,nginx,wkhtmltopdf,Django,Ubuntu,Nginx,Wkhtmltopdf,也有类似的问题,但我的配置集不是 相同。我从wkhtmltopdf.org下载了wkhtmltopdf,放在 项目文件夹,我不明白为什么我仍然被拒绝访问 试图指示django运行wkhtmltopdf以生成pdf文件 使用UNICORN运行NGINX 使用主管 Ubuntu 16 在我的unicorn_主管日志中,我得到: wkhtmltopdf文件: 独角兽工艺: NGINX工艺 为什么我被拒绝访问,因为wkhtmltopdf文件所有者是同一个运行的unicorn 我可以在终端中运行该命令,但
它将以超级用户身份运行,并绕过所有权限。如果您没有访问超级用户的权限,我不确定。当我试图运行一些不应该运行的东西时,这种情况有时会发生在我身上。虽然我使用的是ubuntu 14.04,但我不理解这一点。我通过创建一个shell脚本文件来调用wkhtmltopdf来解决这个问题 wkhtmltopdf.sh
谢谢大家的帮助。可能的副本不足以对文件拥有执行权限以实际运行它。您还需要列出其所有父文件夹的权限。由于您将wkhtmltopdf放入项目文件夹,我认为这是最可能的问题
Internal Server Error: /invoice/1/pdf
Traceback (most recent call last):emphasized text
File "/home/instantuser/app/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "/home/instantuser/app/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_respons e
response = self.process_exception_by_middleware(e, request)
File "/home/instantuser/app/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_respons e
response = response.render()
File "/home/instantuser/app/lib/python3.5/site-packages/django/template/response.py", line 109, in render
self.content = self.rendered_content
File "/home/instantuser/app/lib/python3.5/site-packages/wkhtmltopdf/views.py", line 78, in rendered_content
cmd_options=cmd_options
File "/home/instantuser/app/lib/python3.5/site-packages/wkhtmltopdf/utils.py", line 186, in render_pdf_from_temp late
cmd_options=cmd_options)
File "/home/instantuser/app/lib/python3.5/site-packages/wkhtmltopdf/utils.py", line 124, in convert_to_pdf
return wkhtmltopdf(pages=filename, **cmd_options)
File "/home/instantuser/app/lib/python3.5/site-packages/wkhtmltopdf/utils.py", line 110, in wkhtmltopdf
return check_output(ck_args, **ck_kwargs)
File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 693, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
-rwxr-xr-x 1 instantuser instantuser 39804584 Nov 22 10:11 wkhtmltopdf
instant+ 2949 0.1 0.5 70344 23216 ? S 18:51 0:00 /home/instantuser/app/bin/python3 ../bin/gunicorn instanthst.wsgi:application --name instanthst --workers 3 --user=instantuser --group=instantuser --bind=unix:/home/instantuser/app/instanthst/run/gunicorn.sock --log-level=debug --log-file=-
instant+ 2954 0.3 1.2 171712 51992 ? S 18:51 0:00 /home/instantuser/app/bin/python3 ../bin/gunicorn instanthst.wsgi:application --name instanthst --workers 3 --user=instantuser --group=instantuser --bind=unix:/home/instantuser/app/instanthst/run/gunicorn.sock --log-level=debug --log-file=-
instant+ 2955 0.3 1.2 171704 51936 ? S 18:51 0:00 /home/instantuser/app/bin/python3 ../bin/gunicorn instanthst.wsgi:application --name instanthst --workers 3 --user=instantuser --group=instantuser --bind=unix:/home/instantuser/app/instanthst/run/gunicorn.sock --log-level=debug --log-file=-
instant+ 2957 0.3 1.2 171568 51960 ? S 18:51 0:00 /home/instantuser/app/bin/python3 ../bin/gunicorn instanthst.wsgi:application --name instanthst --workers 3 --user=instantuser --group=instantuser --bind=unix:/home/instantuser/app/instanthst/run/gunicorn.sock --log-level=debug --log-file=-
ubuntu 2970 0.0 0.0 12944 964 pts/0 S+ 18:53 0:00 grep --color=auto unicorn
root 3006 0.0 0.0 125112 1460 ? Ss 18:55 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 3007 0.0 0.0 125436 3108 ? S 18:55 0:00 nginx: worker process
www-data 3008 0.0 0.1 125712 5060 ? S 18:55 0:00 nginx: worker process
ubuntu 3104 0.0 0.0 12944 940 pts/0 S+ 19:09 0:00 grep --color=auto nginx
#!/bin/sh
xvfb-run -a -s "-screen 0 1024x768x16" wkhtmltopdf $*