Hello,
I am using Django Rest framework and token based authentication. I hosted the webapp in Pythonanywhere website. When i try to login (using rest api call), Token generation is failing. Following is error details from pythonanywhere error log file
2016-07-01 13:25:42,249 : new_token = Token.objects.create(user=user) 2016-07-01 13:25:42,250 :AttributeError: type object 'Token' has no attribute 'objects'
I checked following things 1) Database has authtoken_token table
2) INSTALLED APPS has
'rest_framework', 'rest_framework.authtoken',
3) Settings has
REST_FRAMEWORK = {
# Use Django's standard django.contrib.auth
permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.AllowAny',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
)
}
This is working in my local system. I tried makemigrations and migrate command. It seems fine.
Please let me know if i am missing anything here.
Thanks in advance.