Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in include_docs_urls when upgrading from 3.9 to 3.10 #6826

Closed
4 of 6 tasks
thnee opened this issue Jul 19, 2019 · 3 comments
Closed
4 of 6 tasks

Crash in include_docs_urls when upgrading from 3.9 to 3.10 #6826

thnee opened this issue Jul 19, 2019 · 3 comments

Comments

@thnee
Copy link

thnee commented Jul 19, 2019

Checklist

  • I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

Use djangorestframework==3.10.0

In urls.py:

from django.urls import path
from rest_framework.documentation import include_docs_urls

urlpatterns = [
    path("docs/", include_docs_urls(title="Platinum API docs")),
]

Visit /docs/ in browser.

Expected behavior

No crash please.

Actual behavior

2019-07-19 11:41:21,446 [django.request] [ERROR] Internal Server Error: /docs/
Traceback (most recent call last):
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/views.py", line 497, in dispatch
    response = self.handle_exception(exc)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/schemas/views.py", line 48, in handle_exception
    return super().handle_exception(exc)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/views.py", line 457, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/views.py", line 468, in raise_uncaught_exception
    raise exc
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/views.py", line 494, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/schemas/views.py", line 37, in get
    schema = self.schema_generator.get_schema(request, self.public)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/schemas/coreapi.py", line 153, in get_schema
    links = self.get_links(None if public else request)
  File "/home/thnee/.pyenv/versions/lookatech-platinum/lib/python3.6/site-packages/rest_framework/schemas/coreapi.py", line 140, in get_links
    link = view.schema.get_link(path, method, base_url=self.url)
AttributeError: 'AutoSchema' object has no attribute 'get_link'
2019-07-19 11:41:21,449 [django.server] [ERROR] "GET /docs/ HTTP/1.1" 500 27
@thnee thnee changed the title Crash in include_docs_urls when upgrading from 3.9 to 3.10 Crash in include_docs_urls when upgrading from 3.9 to 3.10 Jul 19, 2019
@thnee
Copy link
Author

thnee commented Jul 19, 2019

Same problem with version 3.10.1. Downgrading to 3.9.4 solves the problem. All of these tests were done with coreapi 2.3.3 and django 2.2.3.

@carltongibson
Copy link
Collaborator

Duplicate of #6809.

See the 3.10 release notes on Continuing to use CoreAPI.

@mn-48
Copy link

mn-48 commented Jun 29, 2020

add the line in

project/settings.py

REST_FRAMEWORK = { ... 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' }

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

No branches or pull requests

3 participants