Django CMS故障:站点匹配查询不存在 [英] Django CMS malfunction: Site matching query does not exist
问题描述
我已经在项目中安装了所有应用程序,然后在网站部分添加了一个网站,并删除了example.com。现在Django CMS 2.0中的Pages部分不起作用:它引发了一个DoesNotExist异常:站点匹配查询不存在。
at http://127.0.0.1:8000/admin/cms/page/
在我删除example.com网站之前,该部分正常工作。
在settings.py中,我有 SITE_ID = 2
行。不过,在这个电话中:
返回Site.objects.get(pk = site_pk)
in traceback,site_pk = 1。
我该如何解决? p>
解决方案从 http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites
SITE_ID设置指定与该特定设置文件相关联的Site对象的数据库ID。
因此,请检查django_site表并确保正在为您的网站使用正确的SITE_ID。
I've installed all apps in a project, then added a site in the sites section, and deleted example.com. Now Pages section in Django CMS 2.0 isn't working: it raises a DoesNotExist exception:
Site matching query does not exist.
at http://127.0.0.1:8000/admin/cms/page/The section worked normally before I deleted the example.com site.
In settings.py I have
SITE_ID = 2
line. Still, in this call:return Site.objects.get(pk=site_pk)
in traceback, site_pk=1.
How can I fix this?
解决方案From http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites
The SITE_ID setting specifies the database ID of the Site object associated with that particular settings file.
So, check the django_site table and make sure you are using the correct SITE_ID for your site.
这篇关于Django CMS故障:站点匹配查询不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!