我正在试图查看管理页面时,这个错误:的Django MongoDB的SITE_ID错误
InvalidId at /admin/
AutoField (default primary key) values must be strings representing an ObjectId on MongoDB (got u'1' instead). Please make sure your SITE_ID contains a valid ObjectId string.
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.3
Exception Type: InvalidId
Exception Value:
AutoField (default primary key) values must be strings representing an ObjectId on MongoDB (got u'1' instead). Please make sure your SITE_ID contains a valid ObjectId string.
...
所以我用Google搜索周围,计算过,我需要做下面的
./manage.py tellsiteid
The default site's ID is u'50c5766e62f11f41f0332e65'. To use the sites framework, add this line to settings.py:
SITE_ID=u'50c5766e62f11f41f0332e65'
所以我添加它给我settings.py
:
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SITE_ID = u'50c5766e62f11f41f0332e65'
...
我仍然得到相同的错误消息。我应该运行一个syncdb
还是重新启动服务器?因为我已经完成了这两项工作,并且仍然遇到同样的错误。
编辑
我试着在Python外壳观看的SITE_ID
价值,果然...
$ python manage.py shell
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from concepts.settings import *
>>> SITE_ID
1
但git diff
清楚地表明,我已经改变了设置文件,对?
$ git diff
diff --git a/settings.py b/settings.py
index 586ea3a..bb069ed 100644
--- a/settings.py
+++ b/settings.py
@@ -2,6 +2,7 @@
DEBUG = True
TEMPLATE_DEBUG = DEBUG
+SITE_ID = u'50c5766e62f11f41f0332e65'
ADMINS = (
# ('Your Name', '[email protected]'),
...
我在做什么错在这里?