Django-admin:在/ admin / plans / plan /上的TemplateDoesNotExist

时间:2017-04-07 15:33:52

标签: python django django-admin django-1.10 django-plans

我试图让Django-plans应用有效。除了/admin/plans/plan//admin/plans/order//admin/plans/userplan/等正常工作外,所有内容似乎都有效。

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

TemplateDoesNotExist at /admin/plans/plan/ 

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

你知道问题是什么吗?

TRACEBACK

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

1 个答案:

答案 0 :(得分:0)

对于遇到此完全错误的其他人,问题是您使用的是django-ordered-model个包,但尚未向ordered-model添加INSTALLED_APPS settings.py