【发布时间】:2020-09-25 03:48:06
【问题描述】:
Jun 04 18:21:25 dev-strandbase app/web.1 [2020-06-05 01:21:24 +0000] [10] [ERROR] Error handling request /admin/parts_table/part/35/change/
Jun 04 18:21:25 dev-strandbase app/web.1 Traceback (most recent call last):
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle
Jun 04 18:21:25 dev-strandbase app/web.1 self.handle_request(listener, req, client, addr)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
Jun 04 18:21:25 dev-strandbase app/web.1 respiter = self.wsgi(environ, resp.start_response)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 75, in get_response
Jun 04 18:21:25 dev-strandbase app/web.1 response = self._middleware_chain(request)
......
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = response or self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = response or self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = response or self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = response or self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 04 18:21:25 dev-strandbase app/web.1 response = response or self.get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 04 18:21:25 dev-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 04 18:21:25 dev-strandbase app/web.1 response = get_response(request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 145, in _get_response
Jun 04 18:21:25 dev-strandbase app/web.1 response = self.process_exception_by_middleware(e, request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 143, in _get_response
Jun 04 18:21:25 dev-strandbase app/web.1 response = response.render()
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/response.py", line 105, in render
Jun 04 18:21:25 dev-strandbase app/web.1 self.content = self.rendered_content
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/response.py", line 83, in rendered_content
Jun 04 18:21:25 dev-strandbase app/web.1 return template.render(context, self._request)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return self.template.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 171, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return self._render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
Jun 04 18:21:25 dev-strandbase app/web.1 return self.nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return compiled_parent._render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
Jun 04 18:21:25 dev-strandbase app/web.1 return self.nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return compiled_parent._render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
Jun 04 18:21:25 dev-strandbase app/web.1 return self.nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/loader_tags.py", line 62, in render
Jun 04 18:21:25 dev-strandbase app/web.1 result = block.nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
Jun 04 18:21:25 dev-strandbase app/web.1 return nodelist.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 04 18:21:25 dev-strandbase app/web.1 bit = node.render_annotated(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 04 18:21:25 dev-strandbase app/web.1 return self.render(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 986, in render
Jun 04 18:21:25 dev-strandbase app/web.1 output = self.filter_expression.resolve(context)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 697, in resolve
Jun 04 18:21:25 dev-strandbase app/web.1 new_obj = func(obj, *arg_vals)
Jun 04 18:21:25 dev-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaultfilters.py", line 42, in _dec
Jun 04 18:21:25 dev-strandbase app/web.1 args[0] = str(args[0])
Jun 04 18:21:25 dev-strandbase app/web.1 TypeError: 'str' object is not callable
在对我的模型进行一些更改后,我收到了一个奇怪的 TypeError(上图)。我在任何地方都找不到关于如何处理这个问题的任何结果。当我单击删除对象或更新对象时,我得到相同的错误,当我更新/删除使用“部件”模型作为外键的对象时,我得到相同的 TypeError(但前面的错误日志不同)。
这是调用相同模型的不同页面的错误日志
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 05 16:41:04 production-strandbase app/web.1 response = response or self.get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 05 16:41:04 production-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 05 16:41:04 production-strandbase app/web.1 response = response or self.get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 05 16:41:04 production-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 05 16:41:04 production-strandbase app/web.1 response = response or self.get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 05 16:41:04 production-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 05 16:41:04 production-strandbase app/web.1 response = response or self.get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 05 16:41:04 production-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
Jun 05 16:41:04 production-strandbase app/web.1 response = response or self.get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = response_for_exception(request, exc)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
Jun 05 16:41:04 production-strandbase app/web.1 response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Jun 05 16:41:04 production-strandbase app/web.1 response = get_response(request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 145, in _get_response
Jun 05 16:41:04 production-strandbase app/web.1 response = self.process_exception_by_middleware(e, request)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 143, in _get_response
Jun 05 16:41:04 production-strandbase app/web.1 response = response.render()
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/response.py", line 105, in render
Jun 05 16:41:04 production-strandbase app/web.1 self.content = self.rendered_content
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/response.py", line 70, in rendered_content
Jun 05 16:41:04 production-strandbase app/web.1 ret = renderer.render(self.data, accepted_media_type, context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 724, in render
Jun 05 16:41:04 production-strandbase app/web.1 context = self.get_context(data, accepted_media_type, renderer_context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 696, in get_context
Jun 05 16:41:04 production-strandbase app/web.1 'post_form': self.get_rendered_html_form(data, view, 'POST', request),
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 511, in get_rendered_html_form
Jun 05 16:41:04 production-strandbase app/web.1 return self.render_form_for_serializer(serializer)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 521, in render_form_for_serializer
Jun 05 16:41:04 production-strandbase app/web.1 {'style': {'template_pack': 'rest_framework/horizontal'}}
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 372, in render
Jun 05 16:41:04 production-strandbase app/web.1 return template.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
Jun 05 16:41:04 production-strandbase app/web.1 return self.template.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 171, in render
Jun 05 16:41:04 production-strandbase app/web.1 return self._render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
Jun 05 16:41:04 production-strandbase app/web.1 return self.nodelist.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 05 16:41:04 production-strandbase app/web.1 bit = node.render_annotated(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 05 16:41:04 production-strandbase app/web.1 return self.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaulttags.py", line 209, in render
Jun 05 16:41:04 production-strandbase app/web.1 nodelist.append(node.render_annotated(context))
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 05 16:41:04 production-strandbase app/web.1 return self.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
Jun 05 16:41:04 production-strandbase app/web.1 return nodelist.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 05 16:41:04 production-strandbase app/web.1 bit = node.render_annotated(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 05 16:41:04 production-strandbase app/web.1 return self.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/library.py", line 192, in render
Jun 05 16:41:04 production-strandbase app/web.1 output = self.func(*resolved_args, **resolved_kwargs)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/templatetags/rest_framework.py", line 87, in render_field
Jun 05 16:41:04 production-strandbase app/web.1 return renderer.render_field(field, style)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/renderers.py", line 351, in render_field
Jun 05 16:41:04 production-strandbase app/web.1 return template.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
Jun 05 16:41:04 production-strandbase app/web.1 return self.template.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 171, in render
Jun 05 16:41:04 production-strandbase app/web.1 return self._render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
Jun 05 16:41:04 production-strandbase app/web.1 return self.nodelist.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 936, in render
Jun 05 16:41:04 production-strandbase app/web.1 bit = node.render_annotated(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
Jun 05 16:41:04 production-strandbase app/web.1 return self.render(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/defaulttags.py", line 161, in render
Jun 05 16:41:04 production-strandbase app/web.1 values = self.sequence.resolve(context, ignore_failures=True)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 670, in resolve
Jun 05 16:41:04 production-strandbase app/web.1 obj = self.var.resolve(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 795, in resolve
Jun 05 16:41:04 production-strandbase app/web.1 value = self._resolve_lookup(context)
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/django/template/base.py", line 857, in _resolve_lookup
Jun 05 16:41:04 production-strandbase app/web.1 current = current()
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/relations.py", line 215, in iter_options
Jun 05 16:41:04 production-strandbase app/web.1 self.get_choices(cutoff=self.html_cutoff),
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/relations.py", line 202, in get_choices
Jun 05 16:41:04 production-strandbase app/web.1 for item in queryset
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/relations.py", line 202, in <listcomp>
Jun 05 16:41:04 production-strandbase app/web.1 for item in queryset
Jun 05 16:41:04 production-strandbase app/web.1 File "/app/.heroku/python/lib/python3.7/site-packages/rest_framework/relations.py", line 221, in display_value
Jun 05 16:41:04 production-strandbase app/web.1 return str(instance)
Jun 05 16:41:04 production-strandbase app/web.1 TypeError: 'str' object is not callable
Jun 05 16:41:04 production-strandbase app/web.1 10.16.190.48 - - [05/Jun/2020:23:41:04 +0000] "GET /api/partfeatures/ HTTP/1.1" 500 0 "-" "-"```
【问题讨论】:
-
看来你做了
str = ...,所以现在你有变量str,它不能访问函数str()。您必须找到使用str = ...的位置并为变量使用不同的名称。 -
这是我的第一个想法——但看起来我并没有在任何地方使用 str。
-
错误显示
...\template\...的许多路径 - 也许你在某些模板中使用str或者你使用str作为字典的键
标签: python django python-3.x heroku