我有兩個相同的代碼(開發和生產)的實例,我發現這個問題只發生在生產。我部署了一個處女例子,這意味着在那之前沒有W installation的安裝。在W Explorer的資源管理器不顯示任何頁面
W admin管理員顯示,我沒有網頁。我確實有2頁,即使我沒有,也不應該有「歡迎來到W Page頁」(它通常是,它在我的開發實例上)。此外,它看起來像是遺失了一部分網站。
這就是我所看到的,不管我有多少網頁創建(創建他們到達網址)
編輯: 這是在日誌中的完整的堆棧跟蹤
2017-04-21 10:27:08,898 exception 22370 ERROR Internal Server Error: /admin/pages/
Traceback (most recent call last):
File "/opt/..../venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 42, in inner
response = get_response(request)
File "/opt/..../venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/..../venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/..../venv/lib/python3.5/site-packages/django/views/decorators/cache.py", line 43, in _cache_controlled
response = viewfunc(request, *args, **kw)
File "/opt/..../venv/lib/python3.5/site-packages/wagtail/wagtailadmin/decorators.py", line 24, in decorated_view
return view_func(request, *args, **kwargs)
File "/opt/..../venv/lib/python3.5/site-packages/wagtail/wagtailadmin/views/pages.py", line 104, in index
'do_paginate': do_paginate,
File "/opt/..../venv/lib/python3.5/site-packages/django/shortcuts.py", line 30, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader.py", line 68, in render_to_string
return template.render(context, request)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 208, in render
return self._render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 70, in render
result = block.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 70, in render
result = block.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
File "/opt/..../venv/lib/python3.5/site-packages/django/template/defaulttags.py", line 314, in render
if match:
File "/opt/..../venv/lib/python3.5/site-packages/django/core/paginator.py", line 112, in __len__
return len(self.object_list)
File "/opt/..../venv/lib/python3.5/site-packages/django/db/models/query.py", line 238, in __len__
self._fetch_all()
File "/opt/..../venv/lib/python3.5/site-packages/django/db/models/query.py", line 1087, in _fetch_all
self._result_cache = list(self.iterator())
File "/opt/..../venv/lib/python3.5/site-packages/wagtail/wagtailcore/query.py", line 380, in specific_iterator
pages = model.objects.filter(pk__in=pks)
AttributeError: 'NoneType' object has no attribute 'objects'
看起來在頁面上有一個模板錯誤,導致一個部分被無聲跳過(Django在生產模式下的默認行爲)。你可以嘗試在你的'TEMPLATES'設置中添加''debug':True'(按照https://gist.github.com/gasman/e0a9cb8c133db3e17c8e614e4fac883d),看看是否會給你提供更多信息錯誤? – gasman
你說得對。錯誤是'AttributeError:'NoneType'對象沒有屬性'objects'',這實際上不是描述性的。從我能發現它來自'defaulttags.py',然後paginator拋出這個錯誤,因爲它沒有任何頁面去槽。 我可以發佈完整的回溯,但寧可將此對話轉換爲常規回答而非評論。 – Erika
請編輯您的問題以包含完整的追溯。不幸的是,除非我有足夠的信息才能寫出一個答案,否則我們無法將此對話轉移到答案上.-) – gasman