Access back-end console for Flask app deployed using Nginx and WSGI

I’m new to this domain so hopefully my question is not too elementary. I built an app.py file that used pre-trained serialized machine learning models (pickle format) and gave prediction results when received POST-request from the front end user inputs. These inputs are also stored in MongoDB.

I run the app.py using the method:

python app.py 

instead of : export FLASK_APP=app.py then flask run --host=0.0.0.0

The reason is because the former method allows the back-end to take in the pre-trained pickled model while the latter method somehow skipped this step. The result works like a charm in localhost.

Now I’m trying to deploy it to a real web domain. I use an ubuntu virtual server (DigitalOcean) to deploy the app using Nginx and WSGI. I successfully access my domain and see the html file rendered by Nginx. However, when I input the user information, I got in client console an internal server error 500.

I wish to access the back-end console to see what’s going on there but have no idea how to do it on the virtual server. I have spent too much time on this. Any help/direction will be much much appreciated.

P/s: Also, if somebody knows how to use the former method (mentioned above) for deployment in nginx and wsgi, please share 🙂 Right now, I’m starting the app using the command

systemctl start nginx