Il y a des questions similaires, mais mon jeu de configuration n'est pas le same.I téléchargé le wkhtmltopdf de wkhtmltopdf.org, placé sur le dossier du projet , je ne peux pas comprendre pourquoi Je reçois toujours l'accès refusé.Errno 13 Autorisation refusée lors de la tentative d'exécuter wkhtmltopdf
Essayer de pointer django pour exécuter le wkhtmltopdf
afin de générer un fichier pdf.
Courir Nginx avec UNICORN
En utilisant SUPERVISEUR
Ubuntu 16
dans mon unicorn_supervisor log i got:
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
Le fichier wkhtmltopdf:
-rwxr-xr-x 1 instantuser instantuser 39804584 Nov 22 10:11 wkhtmltopdf
processus Unicorn:
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
NGINX processus
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
Pourquoi ai-je vu refuser l'accès depuis le propriétaire du fichier wkhtmltopdf est la même licorne en cours d'exécution?
Je suis capable d'exécuter la commande dans le terminal mais python ne peut pas l'exécuter. Pourquoi?
Possible copie de [Errno 13 Autorisation refusée dans djnago-wkhtmltopdf] (http://stackoverflow.com/questions/28580691/errno-13-permission-denied-in-djnago-wkhtmltopdf) – nomad
Il ne suffit pas d'avoir exécuter les autorisations sur le fichier pour l'exécuter réellement. Vous avez également besoin d'autorisations pour répertorier tous ses dossiers parents. Puisque vous avez placé wkhtmltopdf dans le dossier du projet, je suppose que c'est le problème le plus probable – Marat