-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Deprecation warning for APIs that do not use auth #3494
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Options:
|
Based on the fact that I love to have working defaults my opinion is:
|
Not sure - I'm a bit lukewarm on 3, but perhaps. |
Workaround doesn't work for me. Even if I set None for UNAUTHENTICATED_USER setting it still want me to have additional django.contrib packages.
|
@galuszkak somehow you didn't as api_settings.UNAUTHENTICATED_USER is leading to importing Django's auth models. |
@xordoquy in my settings I have:
So I'm pretty sure that I set that UNAUTHENTICATED_USER... |
@galuszkak Any luck on solving this? |
@akroushan The traceback above indicates that |
@tomchristie I show You settings that I set it to None, regardless of stacktrace that were my settings. @akroushan I just went to have temporary sqlite database. Didn't had time to bother with that. I just added this |
@galuszkak - I can see a snippet from a settings file, tho I can also see from the traceback that From my perspective of the "perhaps a different settings file was actually being used", or "perhaps the REST_FRAMEWORK settings had actually been overwritten else in the user project" are both viable options. If someone can demonstrate how to replicate setting |
@tomchristie I will prepare example with not working solution. |
That'd be fab, thanks. 👍 |
I have met the same question , did it figure out? |
it's still opened. |
When removing authentication entirely you cannot import `django.contrib.auth.models.AnonymousUser` Closes encode#3494
When removing authentication entirely you cannot import `django.contrib.auth.models.AnonymousUser` Closes #3494
When removing authentication entirely you cannot import `django.contrib.auth.models.AnonymousUser` Closes encode#3494
Problem
When a site is using DRF without the need for authentication they will likely end up with a Django + 3rd party app list similar to this:
Now the problem is that any request to a URL using DRF will produce deprecation warnings from the use of ContentType, Permission, Group and User models from contrib.auth and contrib.contenttypes. Each warning looks similar to the following.
I have confirmed that if Django 1.9a1 is used this warning turns into a runtime error:
Workaround
Use this
REST_FRAMEWORK
setting to disable the referencing of AnonymousUserThe text was updated successfully, but these errors were encountered: