如何启动 django cms 项目
我决定看看 django-cms。查看文档后,我使用克隆了存储库
git clone https://github.com/divio/django-cms.git
然后使用我已经安装了 django 1.2.3 安装了它
sudo python setup.py install
。我移至 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
我查看了文档,发现我满足了有关版本的要求,但显然,我'我做错事了。任何帮助将不胜感激。
I decided to take a look to django-cms. After looking at the docs I cloned the repository using
git clone https://github.com/divio/django-cms.git
Then I installed it using
sudo python setup.py install
I already have django 1.2.3 installed. I moved to the example
directory an ran syncdb
which created the following tables:
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...
We can clearly see that the cms tables are not created. I'm obviously facing that problem when running the server and browsing http://localhost:8000/
DatabaseError: no such table: cms_page
I've looked at the docs and seen that I meet the requirements regarding the versions but clearly, I'm doing something wrong. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
django-cms 使用 South 进行数据库迁移。 South 处理的模型不会使用
syncdb
同步到数据库。您必须使用manage.py migrate
。由于您没有来自 django-cms 的任何表和数据要迁移,因此更快的解决方案是此过程:
'south'
INSTALLED_APPS
运行>manage.pysyncdb
(这将从django-cms创建所有表)INSTALLED_APPS
运行中重新启用southmanage.py migrate --fake
下次更新 django-cms 时,您可以运行
manage.py migrate
来更新数据库表。django-cms uses South for database migrations. Models handled by South are not synced to the database using
syncdb
. You have to usemanage.py migrate
.Since you don't have any tables and data from django-cms to migrate, a faster solution would be this process:
'south'
in yourINSTALLED_APPS
manage.py syncdb
(this will create all the tables from django-cms)INSTALLED_APPS
manage.py migrate --fake
The next time you update django-cms, you can then run
manage.py migrate
to update your database tables.您是否将
'cms'
放入settings.py
的INSTALLED_APPS
中?此外,Django-CMS 还需要安装menus
、publisher
和mptt
以及一些中间件。 这是一些很好读的文档!Did you put
'cms'
inINSTALLED_APPS
insettings.py
? Django-CMS furthermore requires alsomenus
,publisher
andmptt
installed as well as some middleware. This is some nice to read documentation on it!一般来说,如果未创建表,应用程序本身可能会出现一些错误:
尝试运行 Django shell 并从应用程序导入模型:
并检查是否获得回溯。
希望这能有所帮助。
In general, if tables are not created there can be some errors in the application itself:
try running Django shell and import a model from the application:
and check if you get a traceback.
Hope this can help.