I use uwsgi deployment django, to call the system-installed pdf2htmlEX in the django program using subprocess.
when using the manage.py runserver that comes with django, the service runs normally.
but after deployment using uwsgi, the returncode of subprocess is-11, which means segment error.
but in the same environment, with the same parameters and files, the runserver call status is normal, and it is normal to run the python program alone, but the call is not normal after deployment using uwsgi. How is this going on?
(check if you add close-on-exec, to the uwsgi setting, but it doesn"t work either.) The
code looks like this.
from subprocess import call
def pdf2html(pdfpath,outputpath,filename):
"""pdfhtml,html"""
if not os.path.exists(outputpath + "/" + filename):
os.mkdir(outputpath + "/" + filename)
shellstr = ["pdf2htmlEX", "--dest-dir", outputpath + "/" + filename, "--embed-font", "0","--embed-image", "0","--embed-external-font", "0","--embed-css", "0", "--no-drm", "1", pdfpath + "/" + filename + ".pdf"]
print(shellstr)
shellresult = call(shellstr,shell=False,close_fds=True)
return shellresult
def (request):
-sharp......
returncode = pdf2html(...) -sharpuwsgi -11
my uwsgi configuration:
-sharp backend_uwsgi.ini file
[uwsgi]
-sharp Django-related settings
-sharp the base directory (full path)
chdir = /home/serverend/comengine
-sharp Django"s wsgi file
module = comengine.wsgi
-sharp process-related settings
-sharp master
master = true
-sharp maximum number of worker processes
processes = 8
threads = 4
post-buffering = 65536
buffer-size = 65536
-sharp the socket (use the full path to be safe)socketsock
socket = /home/serverend/comengine/comengine/comengine.sock
-sharp ... with appropriate permissions - may be needed
chmod-socket = 666
-sharp clear environment on exit
vacuum = true
uwsgi_read_timeout = 60000
uwsgi_send_timeout = 60000
-sharpaccess log
disable-logging = true
-sharp
max-requests = 1000
-sharp1000M
reload-on-as = 50000
reload-on-rss = 8500
-sharp
thunder-lock
-sharp 72000
worker-reload-mercy = 72000
-sharpignore-sigpipe = true
-sharpignore-write-errors = true
-sharpdisable-write-exception = true
close-on-exec = true
touch-logreopen = /home/serverend/nginxsetting/log/.touchforlogrotate
daemonize = /home/serverend/nginxsetting/log/uwsgi.log