Django's error memorandum. When django-rest-framework was introduced. TypeError 'RenameAttributes' object is not iterable
It was caused by settings.py. this
settings.py
# TypeError 'RenameAttributes' object is not iterable
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': 'django_filters.rest_framework.DjangoFilterBackend',
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 5
}
do this
settings.py
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'DEFAULT_PAGINATION_CLASS': ('rest_framework.pagination.PageNumberPagination'),
'PAGE_SIZE': 5
}
I was able to do this
settings.py
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 5
}
settings.py
# TypeError 'RenameAttributes' object is not iterable
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend'),
'DEFAULT_PAGINATION_CLASS': ('rest_framework.pagination.PageNumberPagination'),
'PAGE_SIZE': 5
}
settings.py
# TypeError 'list' object is not callable
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS':['django_filters.rest_framework.DjangoFilterBackend'],
'DEFAULT_PAGINATION_CLASS': ['rest_framework.pagination.PageNumberPagination'],
'PAGE_SIZE': 5
}
I don't know why it didn't work, so inconvenience may occur later ... Did you get an error after trying a lot? It was a memorandum.
Recommended Posts