Search code examples
pythonflaskpythonanywhere

500 Internal Server Error (trying to upload file)


I have small app in flask was is hosted on pythonanywhere. When I try uploading a file I get 500 error. I copied the code exactly except for changing the UPLOAD_FOLDER path and ALLOWED_EXTENSIONS. Local(on my computer) all working good but on server not.

Log error

My Code


Solution

  • Looks like the problem is in UPLOAD_FOLDER path value.

    Your python script complains it can't find the directory you set up for uploads. And since you set up it as:

    UPLOAD_FOLDER = 'upload/'
    

    And in docs this variable has absolute path to the directory, I think, if you change upload/ to

    UPLOAD_FOLDER = '/absolute/path/to/your/upload/directory/'
    

    it would help.