TemplateDoesNotExist - Django Error
Solution 1:
Make sure you have rest_framework
listed in your settings.py
INSTALLED_APPS
.
Solution 2:
Please note that the DRF attempts to return data in the same format that was requested. From your browser, this is most likely HTML. To specify an alternative response, use the ?format=
parameter. For example: ?format=json
.
The TemplateDoesNotExist
error occurs most commonly when you are visiting an API endpoint in your browser and you do not have the rest_framework
included in your list of installed apps, as described by other respondents.
If you do not have DRF included in your list of apps, but don't want to use the HTML Admin DRF page, try using an alternative format to 'side-step' this error message.
More info from the docs here: http://www.django-rest-framework.org/topics/browsable-api/#formats