2017-02-20 194 views
0

我已經在一些其他項目上使用了Wagtail的ModelAdmin,但是這是我第一次試圖將它與從Page繼承的模型一起使用。一個簡單的ModelAdmin示例的TemplateDoesNotExist錯誤

我複製了simple example模板並刪除了與我的BlogPageModel無關的部分。

鏈接到ModelAdmin顯示爲預期,但是當我點擊它時,我得到TemplateDoesNotExist at /admin/blog/blogpage/

我不記得之前必須設置模板。有沒有我錯過的設置?

鶺鴒:1.9/ Django的:1.10.5/ 的Python:3.5.2

更新:我從models.Model繼承以及結果相同的模型試了一下。

回溯如下:

Internal Server Error: /admin/blog/blogpage/ 
Traceback (most recent call last): 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner 
    response = get_response(request) 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response 
    response = self._get_response(request) 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response 
    response = self.process_exception_by_middleware(e, request) 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response 
    response = response.render() 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 109, in render 
    self.content = self.rendered_content 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 84, in rendered_content 
    template = self.resolve_template(self.template_name) 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 66, in resolve_template 
    return select_template(template, using=self.using) 
    File "/Users/username/.virtualenv/lib/python3.5/site-packages/django/template/loader.py", line 53, in select_template 
    raise TemplateDoesNotExist(', '.join(template_name_list), chain=chain) 
django.template.exceptions.TemplateDoesNotExist: modeladmin/blog/blogpage/index.html, modeladmin/blog/index.html, modeladmin/index.html 
[21/Feb/2017 07:56:38] "GET /admin/blog/blogpage/ HTTP/1.1" 500 110901 
+0

您可以發佈完整的錯誤消息,包括堆棧跟蹤嗎? – gasman

+0

當然,@gasman。感謝問! –

回答

2

我懷疑你已經錯過了加'wagtail.contrib.modeladmin'INSTALLED_APPS

+0

謝謝。當我先前掃描它時,我錯誤地在那裏看到了它。 –