我有一个基于 Django 1.9 构建的应用程序,但现在我已将其升级到 2.2。好吧,我遇到了一个奇怪的错误,我无法使用现有的类似解决方案来解决它。在我的例子中,我们从一个不同的文件中获取 templateResponse 然后是内置的
[说 x.py]-
class TemplateResponse(DefaultResponse):
"""A normal response involving data that can be sent to fill in a
template. Since the template is specific to HTML responses, when
a JSON response is desired, this class is indistinguishable
from DefaultResponse."""
def __init__(self, template, data, status=200):
self.data = data
self.template = template
self.status = status
[基础.py]-
def home(guts):
return TemplateResponse(template, {'c_sk': c_nt,
'd_sk_count': d_sk_count}
回溯错误 -
response = get_response(request) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/new_cl/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response
response = self.process_exception_by_middleware(e, request) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/new_cl/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) …
▶ Local vars
/usr/lib/python3.6/contextlib.py in inner
return func(*args, **kwds) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/new_cl/lib/python3.6/site-packages/django/contrib/auth/decorators.py in _wrapped_view
return view_func(request, *args, **kwargs) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/main/x.py in g
response = seed.sprout(context, format) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/main/x.py in sprout
return self.sprout_html(context) …
▶ Local vars
/home/gaurav/Desktop/a Upgrade Work/a/main/x.py in sprout_html
body = self.template.render(context) …
▶ Local vars
慕标琳琳
largeQ
相关分类