python - 如何启动 django cms 项目

标签 python django django-cms

我决定看看 django-cms。查看文档后,我使用

克隆了存储库
git clone https://github.com/divio/django-cms.git

然后我安装它使用

sudo python setup.py install

我已经安装了 django 1.2.3。我移动到 example 目录并运行 syncdb 创建了下表:

Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_admin_log
Creating table django_site
Creating table sampleapp_category
Creating table sampleapp_picture
Creating table south_migrationhistory



You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes...

我们可以清楚地看到没有创建 cms 表。我在运行服务器和浏览 http://localhost:8000/

时显然遇到了这个问题
DatabaseError: no such table: cms_page

我查看了文档,发现我符合有关版本的要求,但很明显,我做错了什么。任何帮助将不胜感激。

最佳答案

django-cms 使用 South用于数据库迁移。 South 处理的模型未使用 syncdb 同步到数据库。你必须使用 manage.py migrate .

由于您没有来自 django-cms 的任何表和数据要迁移,所以更快的解决方案是这个过程:

  • 在你的INSTALLED_APPS中注释掉'south'
  • 运行 manage.py syncdb(这将从 django-cms 创建所有表)
  • 在您的INSTALLED_APPS中重新启用南方
  • 运行 manage.py migrate --fake

下次更新 django-cms 时,您可以运行 manage.py migrate 来更新数据库表。

关于python - 如何启动 django cms 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4438258/

相关文章:

python - 初学者用元组排序

python - 从文本生成关键字的简单方法是什么?

python - Django:正确 request.POST 中的值但无法保存表单

python - 发布后单用户补丁时jmeter引发线程异常

python - 正则表达式以匹配 YAML 中的键

javascript - Raspberry Pi 上的 Web 界面

Django:使用 ForeignKey 注释对象的计数/总和 - 错误输出

python - 在模板中指定 Django CMS 占位符类型(文本、图片、链接)

python - Django CMS page_attribute 退回到其他值?