TemplateDoesNotExist Multiple API endpoints #978

Closed
opened 2025-12-29 16:27:32 +01:00 by adam · 5 comments
Owner

Originally created by @mw-0 on GitHub (May 22, 2017).

Issue type:

Python version: 2.7.5
NetBox version: 2.0.3

On a fresh build from master i cannot open various api endpoints without an error.
Example.
api/dcim/regions/ works fine
/api/dcim/sites/ produces error:
TemplateDoesNotExist at /api/dcim/sites/
django_filters/rest_framework/form.html
Request Method: GET
Request URL: http://****/api/dcim/sites/
Django Version: 1.11.1
Exception Type: TemplateDoesNotExist
Exception Value:
django_filters/rest_framework/form.html
Exception Location: /usr/lib/python2.7/site-packages/django/template/loader.py in get_template, line 25
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/opt/netbox/netbox',
'/opt/netbox/netbox',
'/usr/bin',
'/usr/lib64/python27.zip',
'/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages']
Server time: Mon, 22 May 2017 09:53:59 +0000
Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django:
django.template.loaders.filesystem.Loader: /opt/netbox/netbox/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django/contrib/admin/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django/contrib/auth/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/debug_toolbar/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django_tables2/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/mptt/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/rest_framework/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/rest_framework_swagger/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /opt/netbox/netbox/secrets/templates/django_filters/rest_framework/form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /opt/netbox/netbox/utilities/templates/django_filters/rest_framework/form.html (Source does not exist)

I get get to endpoint with siteid using /api/dcim/sites/2/

Originally created by @mw-0 on GitHub (May 22, 2017). <!-- Please note: GitHub issues are to be used only for feature requests and bug reports. For installation assistance or general discussion, please join us on the mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please indicate "bug report" or "feature request" below. Be sure to search the existing set of issues (both open and closed) to see if a similar issue has already been raised. --> ### Issue type: <!-- If filing a bug, please indicate the version of Python and NetBox you are running. (This is not necessary for feature requests.) --> **Python version:** 2.7.5 **NetBox version:** 2.0.3 <!-- If filing a bug, please record the exact steps taken to reproduce the bug and any errors messages that are generated. If filing a feature request, please precisely describe the data model or workflow you would like to see implemented, and provide a use case. --> On a fresh build from master i cannot open various api endpoints without an error. Example. api/dcim/regions/ works fine /api/dcim/sites/ produces error: TemplateDoesNotExist at /api/dcim/sites/ django_filters/rest_framework/form.html Request Method: GET Request URL: http://****/api/dcim/sites/ Django Version: 1.11.1 Exception Type: TemplateDoesNotExist Exception Value: django_filters/rest_framework/form.html Exception Location: /usr/lib/python2.7/site-packages/django/template/loader.py in get_template, line 25 Python Executable: /usr/bin/python Python Version: 2.7.5 Python Path: ['/opt/netbox/netbox', '/opt/netbox/netbox', '/usr/bin', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages'] Server time: Mon, 22 May 2017 09:53:59 +0000 Template-loader postmortem Django tried loading these templates, in this order: Using engine django: django.template.loaders.filesystem.Loader: /opt/netbox/netbox/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django/contrib/admin/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django/contrib/auth/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/debug_toolbar/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/django_tables2/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/mptt/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/rest_framework/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/lib/python2.7/site-packages/rest_framework_swagger/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /opt/netbox/netbox/secrets/templates/django_filters/rest_framework/form.html (Source does not exist) django.template.loaders.app_directories.Loader: /opt/netbox/netbox/utilities/templates/django_filters/rest_framework/form.html (Source does not exist) I get get to endpoint with siteid using /api/dcim/sites/2/
adam closed this issue 2025-12-29 16:27:32 +01:00
Author
Owner

@mw-0 commented on GitHub (May 22, 2017):

This seems to be a permissions error though as i can get to it using token

@mw-0 commented on GitHub (May 22, 2017): This seems to be a permissions error though as i can get to it using token
Author
Owner

@jeremystretch commented on GitHub (May 22, 2017):

GitHub issues are intended for reporting bugs and requesting features. For general discussion or assistance with installation issues, please post to our mailing list.

@jeremystretch commented on GitHub (May 22, 2017): GitHub issues are intended for reporting bugs and requesting features. For general discussion or assistance with installation issues, please post to our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss).
Author
Owner

@Zanthras commented on GitHub (May 23, 2017):

It might be a bug, i ran into the same issue and resolved it by adding 'django_filters' to the list of installed apps in settings.py.

@Zanthras commented on GitHub (May 23, 2017): It might be a bug, i ran into the same issue and resolved it by adding 'django_filters' to the list of installed apps in settings.py.
Author
Owner

@mw-0 commented on GitHub (May 24, 2017):

If this is different behavior from 1.96 which i did not see the change then fine. I have the same issue either from my upgraded install or from a fresh install. I have just gone ahead with using authentication instead of using anonymous access to read these parts.

@mw-0 commented on GitHub (May 24, 2017): If this is different behavior from 1.96 which i did not see the change then fine. I have the same issue either from my upgraded install or from a fresh install. I have just gone ahead with using authentication instead of using anonymous access to read these parts.
Author
Owner

@jeremystretch commented on GitHub (May 24, 2017):

Looks like something changed in django-filters and/or DRF: https://github.com/carltongibson/django-filter/issues/562 Only new installations of NetBox seem to be affected.

I'll add django_filters to INSTALLED_APPS in the settings.

@jeremystretch commented on GitHub (May 24, 2017): Looks like something changed in django-filters and/or DRF: https://github.com/carltongibson/django-filter/issues/562 Only new installations of NetBox seem to be affected. I'll add `django_filters` to `INSTALLED_APPS` in the settings.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#978