I have a CGI form which takes a CSV sheet and email and calls two individual python scripts which run in the background. These take about 15 minutes to execute. I want to make an asynchronous call to these scripts so that I can display some message and prevent apache timeout.
Here is my code
import os
import cgi, cgitb
import csv
import sys
import subprocess
import io
cgitb.enable()
form = cgi.FieldStorage()
filedata = form['file']
filecontent = filedata.file.read().splitlines()
email=form.getvalue('email_address')
email = str(email)
subprocess.Popen([sys.executable, 'giw.py', str(email)], shell=False,
stdin=None, stdout=None, stderr=None, close_fds=True)
subprocess.Popen([sys.executable, 'mailer.py', str(email)], shell=False,
stdin=None, stdout=None, stderr=None, close_fds=True)