Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Django deprecation warnings #589

Closed
dbrgn opened this issue Jun 29, 2019 · 13 comments · Fixed by #634
Closed

Django deprecation warnings #589

dbrgn opened this issue Jun 29, 2019 · 13 comments · Fixed by #634

Comments

@dbrgn
Copy link

dbrgn commented Jun 29, 2019

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))
@wbwlkr
Copy link

wbwlkr commented Jan 2, 2020

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.

@Cabalist
Copy link

Cabalist commented Jan 2, 2020

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

regisb added a commit to regisb/sorl-thumbnail that referenced this issue Apr 30, 2020
The previous settings structure was causing the loading of all django
settings, including those that are deprecated. This was causing
deprecation warnings for most users. These warnings could be disabled at
the cost of hiding all django deprecation warnings, which was too bad.

We took the opportunity to get rid of a now useless test utility:
"override_custom_settings".

Close jazzband#589.
@regisb
Copy link
Contributor

regisb commented Apr 30, 2020

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.

regisb added a commit to regisb/sorl-thumbnail that referenced this issue May 31, 2020
The previous settings structure was causing the loading of all django
settings, including those that are deprecated. This was causing
deprecation warnings for most users. These warnings could be disabled at
the cost of hiding all django deprecation warnings, which was too bad.

We took the opportunity to get rid of a now useless test utility:
"override_custom_settings".

Close jazzband#589.
@CARocha
Copy link

CARocha commented Jun 17, 2020

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

claudep pushed a commit that referenced this issue Jul 22, 2020
The previous settings structure was causing the loading of all django
settings, including those that are deprecated. This was causing
deprecation warnings for most users. These warnings could be disabled at
the cost of hiding all django deprecation warnings, which was too bad.

We took the opportunity to get rid of a now useless test utility:
"override_custom_settings".

Close #589.
@nizarmah
Copy link

nizarmah commented Nov 5, 2020

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 👍

@claudep
Copy link
Contributor

claudep commented Nov 5, 2020

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

@aleksihakli
Copy link
Member

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

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

@nizarmah
Copy link

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.

@nizarmah
Copy link

@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?

@aleksihakli
Copy link
Member

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.

@nizarmah
Copy link

I've emailed @camilonova, hopefully we'll receive an update 👍

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 🙂 and offering to volunteer.
Hopefully that won't be necessary, and @camilonova would be able to create a new release for us 👍

@regisb
Copy link
Contributor

regisb commented Nov 18, 2020

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

@nizarmah
Copy link

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 ❤️)

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

Successfully merging a pull request may close this issue.

8 participants