If you use the built-in mod_wsgi mode, which can happen because Apache controls the lifetime of processes and can process them if it believes that the process is no longer needed due to insufficient traffic.
You might be thinking, “But I'm using daemon mode, not built-in mode,” but you're not really the way your configuration is wrong. You have:
<VirtualHost *:5010> ServerName localhost WSGIDaemonProcess entry user=kesiena group=staff threads=5 WSGIScriptAlias "/" "/Users/kesiena/Dropbox (MIT)/Sites/onetext/onetext.local.wsgi" <directory "/Users/kesiena/Dropbox (MIT)/Sites/onetext/app"> WSGIProcessGroup start WSGIApplicationGroup %{GLOBAL} WSGIScriptReloading On Order deny,allow Allow from all </directory> </virtualhost>
This Directory block does not use a directory that matches the path in WSGIScriptAlias , so none of them apply.
Using:
<VirtualHost *:5010> ServerName localhost WSGIDaemonProcess entry user=kesiena group=staff threads=5 WSGIScriptAlias "/" "/Users/kesiena/Dropbox (MIT)/Sites/onetext/onetext.local.wsgi" <directory "/Users/kesiena/Dropbox (MIT)/Sites/onetext"> WSGIProcessGroup start WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </directory> </virtualhost>
The only reason it worked without this correspondence is because you have opened access to Apache to place files in this directory, having:
<Directory "/Users/kesiena/Dropbox (MIT)/Sites"> Require all granted </Directory>
It is bad practice to also set DocumentRoot as the parent directory where your application source code exists. With the way it is written, there is a risk that I may go into another port or VirtualHost and download all your application code.
Do not paste the application code into the directory specified in the DocumentRoot section.
By the way, even if you have a WSGI application running in daemon mode, Apache can still process workflows that it will use for proxy requests to mod_wsgi. Therefore, even if your very lengthy request continues to work during the WSGI application, it may fail as soon as it starts sending a response if the workflow was processed in the interim because it worked for too long.
You should definitely handle the long-running operation for the Celery task queue or equivalent.