gpt4 book ai didi

python - Django-admin:TemplateDoesNotExist 位于/admin/plans/plan/

转载 作者:太空宇宙 更新时间:2023-11-03 15:24:07 27 4
gpt4 key购买 nike

我正在尝试制作 Django-plans应用程序工作。一切似乎都正常,除了 /admin/plans/plan/ (/admin/plans/order/, /admin/plans/userplan/等工作正常)。

当我在 Django-admin 中单击计划时,它会返回:

TemplateDoesNotExist at /admin/plans/plan/ 

我不明白为什么它不存在。我查看了 django-plans admin.py 文件,似乎 Plan 没有指定任何特殊模板。

你知道问题出在哪里吗?

追溯

Environment: Request Method: GET Request URL: http://127.0.0.1:8000/admin/plans/plan/

Django Version: 1.10.5 Python Version: 2.7.10 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'authapp', 'presentationapp', 'allauth', 'allauth.account', 'allauth.socialaccount', 'djmoney_rates', 'djmoney', 'api', 'productapp', 'django_extensions', 'mainapp', 'django_tables2', 'engineapp', 'dashboardapp', 'ticketapp', 'celery', 'dbbackup', 'bootstrap3', 'django_filters', 'widget_tweaks', 'cacheapp', 'adminapp', 'djcelery', 'import_export', 'plans', 'request', 'django.contrib.humanize'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'authapp.middleware.BasicAuthMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'request.middleware.RequestMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template loader postmortem Django tried loading these templates, in this order:

Using engine django:
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\auth\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\authapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\presentationapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\allauth\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\productapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django_extensions\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\mainapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django_tables2\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\engineapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\dashboardapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\bootstrap3\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\Desktop\Projekty\FS Dropbox\Dropbox\priceist\adminapp\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\djcelery\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\import_export\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\plans\templates\ordered_model\admin\order_controls.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\request\templates\ordered_model\admin\order_controls.html (Source does not exist)


Template error: In template C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templates\admin\change_list.html, error at line 82 ordered_model/admin/order_controls.html 72 : {% endif %} 73 : {% endblock %} 74 : 75 : <form id="changelist-form" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %} 76 : {% if cl.formset %} 77 : <div>{{ cl.formset.management_form }}</div> 78 : {% endif %} 79 : 80 : {% block result_list %} 81 : {% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %} 82 : {% result_list cl %} 83 : {% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %} 84 : {% endblock %} 85 : {% block pagination %}{% pagination cl %}{% endblock %} 86 : </form> 87 : </div> 88 : </div> 89 : {% endblock %} 90 :

Traceback:

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\core\handlers\exception.py" in inner
39. response = get_response(request)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\core\handlers\base.py" in _get_response
217. response = self.process_exception_by_middleware(e, request)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\core\handlers\base.py" in _get_response
215. response = response.render()

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\response.py" in render
109. self.content = self.rendered_content

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\response.py" in rendered_content
86. content = template.render(context, self._request)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\backends\django.py" in render
68. reraise(exc, self.backend)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\backends\django.py" in reraise
89. six.reraise(exc.__class__, new, sys.exc_info()[2])

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\backends\django.py" in render
66. return self.template.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
208. return self._render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in _render
199. return self.nodelist.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
994. bit = node.render_annotated(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render_annotated
961. return self.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader_tags.py" in render
174. return compiled_parent._render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in _render
199. return self.nodelist.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
994. bit = node.render_annotated(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render_annotated
961. return self.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader_tags.py" in render
174. return compiled_parent._render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in _render
199. return self.nodelist.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
994. bit = node.render_annotated(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render_annotated
961. return self.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader_tags.py" in render
70. result = block.nodelist.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
994. bit = node.render_annotated(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render_annotated
961. return self.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader_tags.py" in render
70. result = block.nodelist.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render
994. bit = node.render_annotated(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\base.py" in render_annotated
961. return self.render(context)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\library.py" in render
225. _dict = self.func(*resolved_args, **resolved_kwargs)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templatetags\admin_list.py" in result_list
339. 'results': list(results(cl))}

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templatetags\admin_list.py" in results
315. yield ResultList(None, items_for_result(cl, res, None))

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templatetags\admin_list.py" in __init__
306. super(ResultList, self).__init__(*items)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\templatetags\admin_list.py" in items_for_result
217. f, attr, value = lookup_field(field_name, result, cl.model_admin)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\contrib\admin\utils.py" in lookup_field
286. value = attr(obj)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\ordered_model\admin.py" in move_up_down_links
69. 'query_string': self.request_query_string

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader.py" in render_to_string
67. template = get_template(template_name, using=using)

File "C:\Users\Milano\PycharmProjects\DropboxWorkspaces\priceist_workspace\priceist_venv\lib\site-packages\django\template\loader.py" in get_template
25. raise TemplateDoesNotExist(template_name, chain=chain)

Exception Type: TemplateDoesNotExist at /admin/plans/plan/ Exception Value: ordered_model/admin/order_controls.html

我无法进入计划,其他页面工作正常。

enter image description here

最佳答案

对于遇到此错误的其他人,问题是您正在使用 django-ordered-model 包,但尚未添加 ordered_modelsettings.py 中的 INSTALLED_APPS

关于python - Django-admin:TemplateDoesNotExist 位于/admin/plans/plan/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43282019/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com