Forums

Image Blog tutorial -- Internal Server Error

I'm trying to do the tutorial here and get a 500 internal server error with no further details (besides that it's on port 443) when I try to upload an image for appadmin. Has anyone else had the same problem?

Hi onezeno,

Do you want to have another go now? I've cleared down some processes. Did you remember to reload your web server process between steps? There is a button to do that on the web apps page.

Cheers

The problem is with file size. The image I want to upload is ~360KB. When I convert it down to 5KB it loads. So the threshold is somewhere between. Does PythonAnywhere limit file size? SQLite by default allows strings of 10E9 characters; I assume the file size default is at least that large.

Hmm, we don't put any limits on file size, other than enforcing a 500MB quota for free users. Sounds like you need to drop some debugging code into the upload function and test it with different file sizes.

Catching exceptions and logging the stacktrace to a file in your home directory using the Python logging module would be what I would suggest.

import logging
logging.basicConfig(filename='/home/onezeno/my_app_log_file')

try:
    # Whatever code you are running

except, exc: 
    logging.debug(str(exc))

See what the stacktrace is telling you and feel free to post it here for further advice.

...it turns out that we were wrong, there's a default upload file size limit that we weren't aware of in one of the bits of code we depend on! The limit was about 128KB, and we've now bumped it up to 2MB. If anyone wants it increased further, let us know.