1👍
I have the same issue when I had REST_FRAMEWORK
two times written for different settings in my settings.py
. I moved everything in one variable and error is gone
- Generate Database Schema using Python
- Client side JS (e.g. AngularJS) + Django REST Backend: Deploy onto single PaaS?
- How do you install mysql-connector-python (development version) through pip?
1👍
If the AssertionError
is about DRF’s ObtainAuthToken
then it is most likely an old bug in DRF. This issue was fixed in DRF>=3.12
. Prior to that, DRF used a wrong class where it was not supposed to.
drf-yasg
seems to not suffer from this upstream bug due to a different injection technique used. drf-spectacular
has a mitigation for the bug starting with 0.24.0
.
Related GH issue with workaround for older drf-spectacular
versions:
https://github.com/tfranzel/drf-spectacular/issues/796#issuecomment-1231464792
Sidenote: If this does not fix your problem and/or it is the same Assertion for some other view, you likely have a misconfigured settings.py
. Make sure DEFAULT_SCHEMA_CLASS
is properly set as stated in the README. Also make sure you are not shooting yourself in the foot by not setting this also in your production settings file. If the problem still persists, please open an issue on Github and get help there.
- Celery task and customize decorator
- How can I automatically let syncdb add a column (no full migration needed)
- Client side JS (e.g. AngularJS) + Django REST Backend: Deploy onto single PaaS?
0👍
Check if you’re importing from rest_framework
!
Having a
from rest_framework.pagination import PageNumberPagination
was all it took to provoke the error. As soon as I removed the import, things started working again.
This even applies when importing other modules which in turn import from rest_framework
. I ended up using the "string imports" like so:
"DEFAULT_PAGINATION_CLASS": "api.pagination.DefaultPagination",
- Django getting the absolute path of a FileField
- Can I have some code constantly run inside Django like a daemon
0👍
I had the same issue. Just make sure you don’t have REST_FRAMEWORK
defined more than once in your settings.py
file.
- Following users like twitter in Django, how would you do it?
- How do I add custom actions to a change model form in Django Admin?
- Combine prefetch_related and annotate in Django
- Django redirect() with anchor (#) parameters
- How can I schedule a Task to execute at a specific time using celery?