Custom flask application running fine on localhost but returning 500 response to external visitors Custom flask application running fine on localhost but returning 500 response to external visitors apache apache

Custom flask application running fine on localhost but returning 500 response to external visitors


Seems like the following line could be a problem:

log_file    = open(LOG + '//captains_log.txt', 'a')

if the path its looking for is: '/var/www/flaskapp/flaskapp/log//captains_log.txt'

that would make sense that an exception is thrown there. Possible that the file is in a different place, on the server, or a / needs to be removed - make sure the open command will find the correct file.

If captains_log.txt is outside the flask app directory, you can copy it in and chown it. if the txt file needs to be outside the directory then you'll have to add the user to the appropriate group, or open up permissions on the actual directory.

chown command should be:

sudo chown www:www /var/www/flaskapp/flaskapp/log/captains_log.txt

and it might be smart to run:

sudo chown -r www:www /var/www