Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Unable to Swagger API docs via viper-web #751

Open
Dhatheway opened this issue Jul 12, 2019 · 5 comments
Open

Unable to Swagger API docs via viper-web #751

Dhatheway opened this issue Jul 12, 2019 · 5 comments

Comments

@Dhatheway
Copy link

After following the install instructions I am able to get everythign up and running, but when I click More-> API Docs I get a 500 page and the following error:

`2019-07-12 15:56:14 - django.request - ERROR - log.py:228 - Internal Server Error: /api/v3/docs/
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py", line 127, in render
compiled_parent = self.get_parent(context)
File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py", line 124, in get_parent
return self.find_template(parent, context)
File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py", line 104, in find_template
template_name, skip=history,
File "/usr/local/lib/python3.6/dist-packages/django/template/engine.py", line 129, in find_template
raise TemplateDoesNotExist(name, tried=tried)
django.template.exceptions.TemplateDoesNotExist: rest_framework_swagger/base.html

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 145, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 143, in _get_response
response = response.render()
File "/usr/local/lib/python3.6/dist-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/usr/local/lib/python3.6/dist-packages/rest_framework/response.py", line 72, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/usr/local/lib/python3.6/dist-packages/rest_framework_swagger/renderers.py", line 58, in render
renderer_context
File "/usr/local/lib/python3.6/dist-packages/django/shortcuts.py", line 36, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/usr/local/lib/python3.6/dist-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py", line 63, in render
reraise(exc, self.backend)
File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py", line 84, in reraise
raise new from exc
django.template.exceptions.TemplateDoesNotExist: rest_framework_swagger/base.html
2019-07-12 15:56:14 - django.server - ERROR - basehttp.py:154 - "GET /api/v3/docs/ HTTP/1.1" 500 5411`

@frennkie
Copy link
Contributor

Hm.. I just checked on my dev system and where SwaggerUI works. Can you try to locate the base.html on your system? Maybe the path is off?

$ `locate rest_framework_swagger/base.html`

venv/lib/python3.6/site-packages/rest_framework_swagger/templates/rest_framework_swagger/base.html

Which version of django-rest-swagger did you install?

$ pip freeze | grep swagger
django-rest-swagger==2.2.0

@Dhatheway
Copy link
Author

Something appears off for sure I searched for "rest_framework_swagger/base.html" with no results, but when I searched for "base.html" I see my path is in-fact different "/usr/local/lib/python3.6/dist-packages/rest_framework/templates/rest_framework/base.html". In terms of "django-rest-swagger" we are the same.

$ pip3 freeze | grep swagger
django-rest-swagger==2.2.0

@Dhatheway
Copy link
Author

Went ahead and updated the path in "viper/web/viperweb/templates/rest_framework_swagger/index.html" from "{% extends "rest_framework_swagger/base.html" %}" to "{% extends "rest_framework/base.html" %}" which allows the doc page to load but it just says:

GET /api/v3/docs/
HTTP 200 OK

@Dhatheway
Copy link
Author

Reset my test vm and followed the install instructions here https://viper-framework.readthedocs.io/en/latest/installation/index.html and still running into the same issue.

$ locate base.html
/home/daniel/viper/viper/web/viperweb/templates/base.html
/usr/local/lib/python3.6/dist-packages/coreschema/templates/base.html
/usr/local/lib/python3.6/dist-packages/django/contrib/admin/templates/admin/base.html
/usr/local/lib/python3.6/dist-packages/rest_framework/templates/rest_framework/base.html
/usr/local/lib/python3.6/dist-packages/rest_framework/templates/rest_framework/login_base.html
/usr/local/lib/python3.6/dist-packages/rest_framework/templates/rest_framework/filters/base.html
/usr/local/lib/python3.6/dist-packages/viper/web/viperweb/templates/base.html

Ubuntu 18.04.2 LTS
Python 3.6.8
django-rest-swagger==2.2.0

@svo80
Copy link

svo80 commented Aug 8, 2019

I am facing the same issue as the previous poster, same Ubuntu version, newly set up in a virtual machine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants