我决定看看 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/