richardbarran / django-photologue

A customizable plug-in photo gallery management application for the Django web framework.
BSD 3-Clause "New" or "Revised" License
676 stars 238 forks source link

cache images & zip upload fail #173

Closed matsaman closed 7 years ago

matsaman commented 7 years ago

Using django-photologue-3.6/Django-1.8/Apache-2.2.22/WSGI.

Everything works from a simple manage.py runserver but not with the Apache instance.

manage.py plcache works just fine, but cached images are not being generated automatically as normal.

ZIP upload fails with:

Could not process file "foo.jpg" in the .zip archive.
...
Could not process file "baz.jpg" in the .zip archive.
The photos have been added to gallery "qux".`
richardbarran commented 7 years ago

"but cached images are not being generated automatically": do you mean that images thumbnails are not generated automatically when an image file is uploaded?

Could not process file "foo.jpg" in the .zip archive.: Pillow could not decode image foo.jpg. If I understand the problem correctly, you can upload the .zip file when running locally, but not when running on a server. Pillow depends on a number of other libraries. Are all of the required libraries installed on the server?

matsaman commented 7 years ago

do you mean that images thumbnails are not generated automatically when an image file is uploaded?

Yes.

you can upload the .zip file when running locally, but not when running on a server

Yes.

Pillow depends on a number of other libraries. Are all of the required libraries installed on the server?

I believe so, yes, I've even rsync'd the malfunctioning server's entire virtualenv & project hierarchy to another system & everything works with manage.py runserver, out of the box. Libraries outside of the virtualenv? Would pip not complain if such libraries were missing?

The only difference is using manage.py runserver vs Apache/WSGI, and using a local PostgreSQL server (or sqlite3) instead of the "live" server's PostgreSQL server. I'm working on duplicating the Apache/WSGI usage locally to see if I can reproduce these issues elsewhere.

richardbarran commented 7 years ago

Would pip not complain if such libraries were missing?

IIRC Pillow at installation time will check for a number of 3rd party libraries, if they're not there it will flash a warning message but continue with the installation. So Pillow might be able to handle some file types on one system, but not on another. Installing Pillow depends on your platform so is not detailed in the instructions.

matsaman commented 7 years ago

All of the pillow install requirements linked are satisfied. pip install --user pillow also completes entirely without error on the system in question.

richardbarran commented 7 years ago

Ok, let's try something different: the error message

Could not process file "foo.jpg" in the .zip archive.

This message appears in the admin interface, but also gets written to logs... together with a detailed error traceback. It could be very useful to have this information. Have you set up up logging on your system? Can you set it up and then post the relevant log messages here?

matsaman commented 7 years ago

Bumping to pillow==4.0.0 and your latest commit of photologue, e99d48e seems to have resolved the image cache issue (sorry didn't test whether only bumping one or the other alone was required). Should probably have checked for those trunk commits sooner. Thanks.

It would seem at this point that the two issues I've mentioned are at most only tangentially related, so my apologies for the multiplicious bug report. I'll report back if & when we resolve the ZIP upload issue.

matsaman commented 7 years ago

We've ported to another server I believe, and now the ZIP uploads work as well, so I'll go ahead and close this, as it's finished for my own selfish purposes. There must've been some oddity with that first server, though it would be nice for peace of mind to sometime figure out what imperfect code was allowing it to happen. Au revoir.

richardbarran commented 7 years ago

Good to hear that you finally fixed the issue.