-
Notifications
You must be signed in to change notification settings - Fork 13
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
Error: Apps aren't loaded yet when user model imported in authentication class #7
Comments
I managed to fix it by retrieving the model in init() via a string like in get_user_model() Still don't understand why it works fine with other apps |
Thanks for taking the time to report the issue along with the steps to reproduce it. A quick workaround for now is to remove The issue here is that the exception handler and other classes are imported in My initial idea is that anything imported in I will be releasing a new version soon (hopefully this weekend) to remove any import in |
Thank you for your explanation, it makes sense. I'll also keep the patch I made as other authentication classes avoid importing models directly. Will the new release also contain the pull requests you made for drf-spectacular :-) ? |
I just pushed v0.11.0 to fix this issue. You should be able to quickly upgrade to the new version after updating the import paths as mentioned here. While the main work for auto-generating error responses with drf-spectacular is done, there are quite some tests and docs that I have yet to add and that would take me quite some time to finish, so it's not part of this release :( |
Hello,
I'm having the following issue after having installed your app. Django doesn't start anymore.
After some investigations, it appears that my custom authentication class (extending BaseAuthentication) which imports user model is the root cause. If I remove that authentication class, the application starts ...
I believe this can be reproduced by creating a dummy authentication class which imports the user model, then register it in settings
I don't have the issues with other apps I mentioned.
Your library looks promising :-)
The text was updated successfully, but these errors were encountered: