richardbarran / django-photologue

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

Added celery support #209

Open AndreasMilants opened 4 years ago

AndreasMilants commented 4 years ago

This PR adds celery support.

Getting a response after uploading a zip-file is way quicker. -> Less server time-outs

This is how the upload works when celery is used:

  1. Send the form to the server
  2. The form + zip_file are saved and a task to create the photos and their sizes is created
  3. A response is sent to the user
  4. One by one, photos will start appearing on the admin dashboard when they are saved

It can be used by setting PHOTOLOGUE_USE_CELERY = True. By default, when using celery, the zip-file is saved on the local disk, since it doesn't need to be there for long and we want quick access. This location can be changed by setting PHOTOLOGUE_TEMP_ZIP_STORAGE = SomeStorage().

67 tests from the master fail on my computer, and after this commit, the same tests fail. It's probably best if you run the tests yourself.

I'm currently using a similar version of this in my own testing environment where I duplicated the code, and so far haven't found any issues.

Should I write tests for the celery update? This means that celery should be installed when running tests in the future. (To be honest I have no clue how to write tests for celery, but I can look it up)

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 67.331% when pulling b6c0267e2852f61f26bfc5c9bfb3895a5608dcd7 on AndreasMilants:master into d48745c8db1d8875e9ea287d6f19ada8dfd6d6b7 on richardbarran:master.

richardbarran commented 4 years ago

Hi Andreas, Thanks for the merge request. I've started reading it - it opens up new possibilities for Photologue, and for making processing more generic. I'd like to make this change as clean and as robust as possible, so I've made a lot of comments on your code. Please view them as constructive comments rather than as criticism. I look forward to reading your modified code.

AndreasMilants commented 4 years ago

Just made a new commit based on your comments. All current tests pass (python 3.8)

richardbarran commented 3 years ago

Hi, Thanks for the updated code - I have added my comments above. I have a thought: it will be really useful add in the documentation instructions on how to use this new feature.