Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FileNotFoundError when developing locally after upgrading to 12.8.0 and django 3. #693

Open
slig opened this issue Mar 13, 2022 · 2 comments

Comments

@slig
Copy link

slig commented Mar 13, 2022

Hi,

When developing locally without the media files available, I keep getting FileNotFoundError printed to the console. I'm calling sorl.thumbnail.get_thumbnail directly (i.e, without using the templatetags.

backend_1   |   File "/opt/venv/lib/python3.9/site-packages/sorl/thumbnail/base.py", line 104, in get_thumbnail
backend_1   |     source_image = default.engine.get_image(source)
backend_1   |   File "/opt/venv/lib/python3.9/site-packages/sorl/thumbnail/engines/pil_engine.py", line 72, in get_image
backend_1   |     buffer = BytesIO(source.read())
backend_1   |   File "/opt/venv/lib/python3.9/site-packages/sorl/thumbnail/images.py", line 162, in read
backend_1   |     f = self.storage.open(self.name)
backend_1   |   File "/opt/venv/lib/python3.9/site-packages/django/core/files/storage.py", line 38, in open
backend_1   |     return self._open(name, mode)
backend_1   |   File "/opt/venv/lib/python3.9/site-packages/django/core/files/storage.py", line 243, in _open
backend_1   |     return File(open(self.path(name), mode))
backend_1   | FileNotFoundError: [Errno 2] No such file or directory: '/workspace/media/posts/image-72.png'

I tried to use the DUMMY config, but the error continue.

I believe that before when I was on django==2.2.2 and sorl-thumbnail==12.5.0 this error was getting suppressed somehow.

Using:

         'sorl.thumbnail': {
             'handlers': ['null'],
         },

Works, but I don't want to suppress every sorl-thumbnail error.

Looking at https://github.com/jazzband/sorl-thumbnail/blob/master/sorl/thumbnail/base.py#L106, and comparing with the 12.5.0 version, I couldn't find any difference, so it must be a new Django default that I'm missing.

Does anyone have any ideas here? Thanks!

@Alex-Sichkar
Copy link

Hello. Is there anything on this issue?

@slig
Copy link
Author

slig commented Jun 20, 2023

The migration never went through and I'm still on Django 2, so I wasn't affect by this yet. Hopefully someone knows a workaround for this by now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants