23

I do not know what configuration to modify.

My git repository URL is: https://github.com/Nomadcoders-Study/Nomadgram

Internal Server Error: /images/all/
Traceback (most recent call last):
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/rest_framework/views.py", line 478, in dispatch
request = self.initialize_request(request, *args, **kwargs)
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/rest_framework/views.py", line 380, in initialize_request
authenticators=self.get_authenticators(),
  File "/usr/local/var/pyenv/versions/3.6.1/envs/nomadgram/lib/python3.6/site-packages/rest_framework/views.py", line 274, in get_authenticators
  return [auth() for auth in self.authentication_classes]
TypeError: 'type' object is not iterable
2
  • 2
    You might need to initiate this variable as a tuple instead of a string. Commented Nov 27, 2018 at 8:35
  • Oh...!!!! Thank you very much!! Thanks to that, I can solve the problem well. Commented Nov 28, 2018 at 1:15

1 Answer 1

84

On the settings.py file append comma at the end of '...JSONWebTokenAuthentication' line as below:

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
    ),
}

Attention: without comma this is not a tuple

Sign up to request clarification or add additional context in comments.

1 Comment

100 likes for telling: "Attention: without comma this is not a tuple"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.