I had a similar issue with Digital Ocean droplet while using Python project, it was Out Of Memory error, this thread helped me: https://www.digitalocean.com/community/questions/python-script-gets-killed
The main advice is to check the system logs
nano /var/log/syslog
and if it's OOM error, you need to either use the swap memory and follow the previous answer.