Django application crashes when deployed to Apache (subprocess running but not running)

My Django application stops working when deployed to Apache (with mod_wsgi). It runs on a Windows server. The application calls a Windows executable called "rex" (Alchemy Remote Executor), which executes the command in another remote window window.

process = subprocess.Popen( ['rex',ip,usr,pwd,command], stdout=subprocess.PIPE, universal_newlines=True ) out, err = process.communicate() 

All this works fine in development, but when deployed to Apache with mod_wsgi, it does not work! The rex program is still running, but it does not perform this task and gives the following message:

 Failed to execute the program: A specified logon session does not exist. It may already have been terminated. 

So, the "rex" program is running, but it cannot make the necessary connections or anything else when it came from Apache. It looks like Apache somehow closes the connection made by "rex.exe" before it can finish!

Any ideas?

0
python django subprocess apache mod-wsgi
source share
1 answer

This is always a problem when deploying to a Windows service that you use as a different user, what do you work at the time of development, and run it as a real user. I had all kinds of problems with this spelling of the updater, which works as a service, which creates problems with file permissions. Can you try logging into Windows as the same user who starts the Apache service, and try executing its rex executable? If you're lucky, you can get rex so that it doesn't work there, where you are interactive, and you can fix it.

But the main idea is to replicate the failure outside of the apache service, and then do whatever it takes to let this thing work while under the permissions of the service, and you are fixed. Maybe your rex program is trying to read or write files (such as configuration files?) That it does not have permissions.

0
source share

All Articles