1👍
I have done 2 similar projects using selenium and requests.
I would recommend to use requests and requests-html because it’s faster and cheaper.
if you insist on selenium there are 2 ways you can do it:
1: Client uploads a file. If the file was valid (input form was valid and you made sure file is not corrupted) you open a selenium web-driver and you have the file and you can open it so running the rest of the script should be possible in that same view.( I don’t recommend this because a lot of things can go wrong and uses a lot of memory if you have a large client base and it takes a lot of time to respond to client and client should not close to webpage to get an answer.)
also you have to configure your web server to keep the connection open.
2: Use a task scheduler. I know django-apscheduler but haven’t used it production.
Client uploads a file. you will save it in database related to your user and add a task to your scheduler then respond to user that file upload was successful.
In that task you will run your script some time later or when possible and after finishing you can save the result or just send an Email to the related user about the result.
If you insist on using selenium the second method is better because you can limit how many selenium web-drivers are open and if all of web-drivers are in use you can delay a task.
Also as I said earlier you can do both of this with requests using sessions and keeping cookies and it would be a lot faster and cheaper.