知道为啥我会收到此错误吗?
Posted
技术标签:
【中文标题】知道为啥我会收到此错误吗?【英文标题】:Any idea why i am getting this error?知道为什么我会收到此错误吗? 【发布时间】:2011-07-23 04:57:05 【问题描述】:我正在尝试在我的 ubuntu 电脑上安装 django-cms。我收到此错误:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 209, in execute
translation.activate('en-us')
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 100, in activate
return _trans.activate(language)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 202, in activate
_active.value = translation(language)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 185, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 162, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/cms/__init__.py", line 14, in <module>
patch_settings()
File "/usr/local/lib/python2.6/dist-packages/cms/conf/__init__.py", line 32, in patch_settings
post_patch()
File "/usr/local/lib/python2.6/dist-packages/cms/conf/patch.py", line 26, in post_patch
settings.CMS_TEMPLATES = tuple(settings.CMS_TEMPLATES) + (
TypeError: 'NoneType' object is not iterable
知道为什么会出现这个错误吗?
谢谢 编辑-1—— 嗨,大家好, 是的,你是对的,我没有将 cms_templates 放在 settings.py 中。我现在这样做了,但现在我收到了这个错误。
DatabaseError at /
没有这样的表:cms_page
请求方法:GET 请求网址:http://localhost:8000/ Django 版本:1.3 异常类型:数据库错误 异常值:
没有这样的表:cms_page
异常位置:/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py 在执行中,第 234 行 Python 可执行文件:/usr/bin/python Python版本:2.6.6 Python 路径:
['/home/naveen/django_projects/myproject', '/usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0']
服务器时间:2011年3月25日星期五15:34:04 -0500
【问题讨论】:
【参考方案1】:它正在寻找settings.CMS_TEMPLATES
。它试图使 None
成为一个会引发该错误的元组。
确保您定义了CMS_TEMPLATES
。
http://docs.django-cms.org/en/2.1.3/getting_started/tutorial.html#configuration-and-setup
【讨论】:
【参考方案2】:您的 CMS_TEMPLATES 设置为无,我不知道那是什么,但我猜这是您需要在某处配置的设置。
【讨论】:
【参考方案3】:settings.CMS_TEMPLATES
是None
,我相信。如果没有相关代码示例,很难判断。
【讨论】:
【参考方案4】:参考编辑1:
您正在使用哪些命令?你在关注tutorial吗?我猜你没有这样做:
python manage.py syncdb
如果您刚刚编写模型,此命令将在数据库中创建表。否则数据库为空,这就是Django找不到cms_page
table的原因。
【讨论】:
是的,你是对的,我删除了 db 文件并再次创建了一个新文件,并执行了 syncdb 命令。效果很好。以上是关于知道为啥我会收到此错误吗?的主要内容,如果未能解决你的问题,请参考以下文章