1
我是Django的noob。Django Flatpages使用:不存在網站匹配查詢
我在管理控制檯中創建了一個flatpages對象,當我訪問我在本地服務器上運行的url時,出現「Site Matching query does not exist」錯誤。 有人可以幫我嗎?
urlpatterns = [
url(r'^', include('main.urls')),
url(r'^home/', include('django.contrib.flatpages.urls')),
url(r'^admin/', admin.site.urls),
]
這裏的錯誤日誌:
Traceback:
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/core/handlers/exception.py" in inner
39. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/contrib/flatpages/views.py" in flatpage
35. site_id = get_current_site(request).id
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/contrib/sites/shortcuts.py" in get_current_site
15. return Site.objects.get_current(request)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/contrib/sites/models.py" in get_current
67. return self._get_site_by_request(request)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/contrib/sites/models.py" in _get_site_by_request
44. SITE_CACHE[host] = self.get(domain__iexact=host)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Django-1.10-py2.7.egg/django/db/models/query.py" in get
385. self.model._meta.object_name
Exception Type: DoesNotExist at /default/
Exception Value: Site matching query does not exist.
我在我的設置中完成了SITE_ID = 1,但是? – jLee