jazzband / django-rest-knox

Authentication Module for django rest auth
MIT License
1.17k stars 213 forks source link

AttributeError: 'Settings' object has no attribute 'KNOX_TOKEN_MODEL' #359

Closed Spawin closed 4 months ago

Spawin commented 4 months ago

There is an error when trying to migrate after adding Knox 5.0.0. This comes from site-packages\knox\migrations\0001_initial.py", line 12 because we are trying to recover settings.KNOX_TOKEN_MODEL which according to the documentation is optional (Settings).

johnraz commented 4 months ago

https://github.com/jazzband/django-rest-knox/blob/develop/knox/settings.py#L19

There is a typo in the line above, the defaults dictionary key should be fixed, @Spawin can you open a PR ?

Spawin commented 4 months ago

https://github.com/jazzband/django-rest-knox/blob/develop/knox/settings.py#L19

There is a typo in the line above, the defaults dictionary key should be fixed, @Spawin can you open a PR ?

The problem is that in the migration we use the global settings from django.conf import settings .

johnraz commented 4 months ago

Then I guess the proper fix is to use the right settings module ☺️

giovannicimolin commented 4 months ago

@johnraz Here's a PR to fix this: https://github.com/jazzband/django-rest-knox/pull/360

Can you review?

johnraz commented 4 months ago

@giovannicimolin approved thanks ! 🙏

giovannicimolin commented 4 months ago

@johnraz Thanks for the review.

@Spawin Can you test with https://pypi.org/project/django-rest-knox/5.0.1/ and close the issue if your issues are fixed?