Exception Value: SMTP.starttls() got an unexpected keyword argument 'keyfile'

Hi !

So I’m builiding my database in pycharm utilising Django, the things is when I try to create the button in the login '“Password forgotten” it is going well until I write my email and I press to reset it, that problem appears.
My Django version is. 4.0.5 and python : 3.12.4.

I read in other forums that I need to upgrade the version of my Django or just copy this in my program, like it says in here:

“After searching, I discovered that this was an issue django/django@2848e5d.
(keyfile and certfile parameters were removed in Python 3.12)
To solve this, you must install Django 4.2.x or copy the django/django/core/mail/backends/smtp.py at main · django/django · GitHub to your local django installation replacing the original 4.1.x file.”

But it didn’t work. Does someone have other solution for it? Thanks in advance.