Pregunta

Am using Wagtail (Django variant CMS) in virtualenv, on FastCGI + Apache + shared hosting.

When uploading images via the built-in Wagtail Image Uploader, certain images work and compile correctly whilst certain uploads cause a 500 Internal Server Error.

Have tried looking for a pattern in types of images that cause the Error but can't spot any similarities.

I am able to upload various JPGs, GIFs, PNGs, sizes varied from 88KB to 236KB, largest dimensions are 1000px x 950px

images uploaded

The files causing errors are also variety of JPGs, GIFs, PNGs. I cannot upload anything bigger than 300KB, although some files that are only 100KB or less also cause 500 error. Uploading via django-admin causes the same issues.

The images work when I upload through sftp and cpanel so there's no problem there.

Wagtail uses Pillow for image handling.

I'm not sure where to begin looking for this. Is it a Pillow or Django error?

¿Fue útil?

Solución

I'd suspect your web server is setting a limit on request sizes - we've encountered similar things when deploying on nginx, which imposes a 1 Mb limit on requests out-of-the-box. (For nginx, the relevant setting is client_max_body_size.) If you're seeing a plain 500 Internal Server Error page rather than a Django error, that does suggest that the error is happening at the web server level rather than within Django... you'll hopefully get a more informative error message if you check the web server's error log.

One easy check you can try is to upload the same files in Wagtail's 'Documents' area - this doesn't do any kind of processing on the files (it only stores them), so if the uploads are still failing there, that eliminates Pillow from the possibilities.

Otros consejos

The Same Error occurred to me but in my case, I was using apache2 web server in Ubuntu VPS.

but doing

sudo chown www-data:www-data mysite/

and

sudo chmod 755 mysite/media

fixes the problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top