I have a Raspberry Pi 3. On my Raspberry Pi I have a Python script that initializes a Flask server, the Python script returns some basic JSON. The Python script is initiated on boot using process manager PM2. The python script is then accessible by the IP address so it can be accessed by other devices. It's basically a small Python API.
This setup works fine but eventually stops working with no indication as to why. When I use my terminal to try and find the cause everything seems to be running fine. PM2 started properly. The IP address of the Raspberry Pi resolves. But my address to the Python Script does not. The address is something like this:
The JSON response (which was working) gets replaced with an error page "This site cannot be reached, 192.168.1.105 refused to connect".
Any adea as to what might be causing this? Or what I could do do find the problem?
If I re-image the SD card with the original working image everything works again, until it unexplainably stops again.
On a side note...
The Raspberry Pi is connected to a BrickPi. The BrickPi is basically an adapter that allows the Raspberry Pi to connect to LEGO EV3 sensors and motors. More data is available here:
I think the BrickPi is unrelated to the issue I'm having.