如何启动 django cms 项目

发布于 2024-10-07 08:57:38 字数 1102 浏览 0 评论 0原文

我决定看看 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柠檬心 2024-10-14 08:57:38

django-cms 使用 South 进行数据库迁移。 South 处理的模型不会使用 syncdb 同步到数据库。您必须使用 manage.py migrate

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

  • 中注释掉 'south'
  • INSTALLED_APPS运行 >manage.pysyncdb(这将从django-cms创建所有表)
  • 在您的INSTALLED_APPS运行中重新启用south
  • manage.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 use manage.py migrate.

Since you don't have any tables and data from django-cms to migrate, a faster solution would be this process:

  • comment out 'south' in your INSTALLED_APPS
  • run manage.py syncdb (this will create all the tables from django-cms)
  • re-enable south in your INSTALLED_APPS
  • run manage.py migrate --fake

The next time you update django-cms, you can then run manage.py migrate to update your database tables.

梦中的蝴蝶 2024-10-14 08:57:38

您是否将 'cms' 放入 settings.pyINSTALLED_APPS 中?此外,Django-CMS 还需要安装 menuspublishermptt 以及一些中间件。 这是一些很好读的文档

Did you put 'cms' in INSTALLED_APPS in settings.py? Django-CMS furthermore requires also menus, publisher and mptt installed as well as some middleware. This is some nice to read documentation on it!

伴随着你 2024-10-14 08:57:38

一般来说,如果未创建表,应用程序本身可能会出现一些错误:
尝试运行 Django shell 并从应用程序导入模型:

python manage.py shell

>>> from csm import models

并检查是否获得回溯。

希望这能有所帮助。

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:

python manage.py shell

>>> from csm import models

and check if you get a traceback.

Hope this can help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文