Sorl-thumbnail: Django deprecation warnings

Created on 29 Jun 2019  ·  14Comments  ·  Source: jazzband/sorl-thumbnail

When starting the devserver on a Django 2.2 project with the latest (12.5) version of sorl-thumbnail, I get the following deprecation warnings:

VENV/lib/python3.5/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango30Warning: The DEFAULT_CONTENT_TYPE setting is deprecated.
  setattr(self, attr, getattr(obj, attr))
VENV/lib/python3.5/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango31Warning: The FILE_CHARSET setting is deprecated. Starting with Django 3.1, all files read from disk must be UTF-8 encoded.
  setattr(self, attr, getattr(obj, attr))
VENV/lib/python3.5/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango30Warning: The DEFAULT_CONTENT_TYPE setting is deprecated.
  setattr(self, attr, getattr(obj, attr))
VENV/lib/python3.5/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango31Warning: The FILE_CHARSET setting is deprecated. Starting with Django 3.1, all files read from disk must be UTF-8 encoded.
  setattr(self, attr, getattr(obj, attr))

Most helpful comment

12.7.0 release is out, thanks a lot! (i'll avoid pinging anyone to avoid extra noise, but yeah, thanks to everyone who helped get this done :heart:)

All 14 comments

Hi @dbrgn

The deprecation warnings are due to the fact that sorl.thumbnail loops on all django settings variables.
https://github.com/jazzband/sorl-thumbnail/blob/12.5.0/sorl/thumbnail/conf/__init__.py#L13

The variable DEFAULT_CONTENT_TYPE exists in Django 2.2.x : https://github.com/django/django/blob/stable/2.2.x/django/conf/global_settings.py#L170
but it is removed in Django 3.0.x :
https://github.com/django/django/blob/stable/3.0.x/django/conf/global_settings.py

Same for the FILE_CHARSET.

The deprecation warnings disappear on Django 3.0.x.

@wbwlkr Is that a common pattern? Why does it do that? Legitimately curious. :)

I think this is a pattern that could be much improved. Think of all the gigatons of CO2 generated by the warning logs for sorl users around the world.

More seriously, this issue is affecting us Open edX developers: when investigating an issue, it's much easier to have clean logs. Also having useless warnings dumped in the console is disturbing for our end users who might not know the difference between a warning and an error.

I opened PR #634 to address this issue.

Hi, i am using Django 2.2.13 and sorl 12.6.3 i still have the warning, how to fix this warning disappear?? I am not clear of the solution

Thank

As @regisb mentioned above, this is an issue that is affecting Open edX developers.

@claudep can you please tag a release that includes the change from #634 ?
Otherwise, we'll need to upgrade the version in order to get rid of the warning. It would be much safer than cloning the master branch :+1:

I'm not sure I can do releases for this package, @aleksihakli maybe?

Hey everyone! @camilonova is the lead who can help with the release, please see

https://jazzband.co/projects/sorl-thumbnail

Thanks @claudep and @aleksihakli

@camilonova would you please be able to help create a new release? It would be really helpful to resolve a bunch of warnings which Open edX developers are receiving.

@aleksihakli sorry to ping you again, but it has been almost two weeks.

I was wondering if there's any hierarchy in Jazzband, in order to escalate this to someone else?

@nizarmah this is the mail for camilo [camilo.[email protected]] maybe you write a e-mail in spanish say
oe camilo por favor haz un release de sorl-thumbnails culicagado.
maybe he listens to you!

Sometimes the maintainers are busy. In those cases pinging via direct email is a good approach. If you have availability and project maintenance experience or are motivated to take care of this project, opening an issue in the Jazzband roadies support project is also an option, increasing the maintainer count.

@jezdez @camilonova I also volunteer as a maintainer for this project if that helps, I can bake new releases and make updates to the project and infrastructure as necessary.

I've emailed @camilonova, hopefully we'll receive an update :+1:

I'm afraid I still lack a bit of experience to take on such projects, so I'll postpone that slightly. Thanks for the suggestion though! I'll definitely keep it in mind.

Thanks for your reply by the way :slightly_smiling_face: and offering to volunteer.
Hopefully that won't be necessary, and @camilonova would be able to create a new release for us :+1:

Should we open a new "pypi release" issue on https://github.com/jazzband-roadies/help/issues/new/choose?

12.7.0 release is out, thanks a lot! (i'll avoid pinging anyone to avoid extra noise, but yeah, thanks to everyone who helped get this done :heart:)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philgyford picture philgyford  ·  16Comments

ghost picture ghost  ·  3Comments

lcmartinezdev picture lcmartinezdev  ·  5Comments

DarwinSurvivor picture DarwinSurvivor  ·  3Comments

devova picture devova  ·  8Comments