Django CMS - cookie cutter : The form could not be loaded. 请检查服务器是否正常运行

标签 django content-management-system django-cms cookiecutter

我开始在一家公司学习网络开发,并负责在 cookiecutter django 中制作一个简单的应用程序,然后将 django-cms 集成到其中。

我使用 django cookie-cutter 启动了一个项目,然后按照以下指南将 django-cms 集成到项目中:

https://github.com/pydanny/cookiecutter-django

http://docs.django-cms.org/en/latest/how_to/install.html

在经历了最初的一些麻烦之后,我设法让它继续运行。 之后,下一步是将我的“投票”应用程序添加到项目中,并将 Django CMS 集成到其中。

为此,我遵循了本教程:

http://docs.django-cms.org/en/latest/introduction/03-integrating_applications.html#incorporate-the-polls-application

我设法一直走到最后一个链接的末尾,然后在第 6 步,发生了这种情况。

每次我尝试从我的站点删除插件,或者当我在 CMS 工具栏上单击创建时,我都会收到此错误(注意:如果我登录/admin,我可以创建页面,但不能通过 cms实际网站上的菜单栏):

The form could not be loaded. Please check that the server is running correctly.

服务器一切正常。那里没有错误。

在控制台中:

Refused to display 'http://127.0.0.1:8000/cms_wizard/create/?page=5&language=en&edit&cms_path=/home/?edit&language=en&structure' in a frame because it set 'X-Frame-Options' to 'deny'.

bundle.toolbar.min.js:1 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

这两天我一直在谷歌搜索,我就是想不通。 任何帮助将不胜感激!

我已经在我的 github 上推送了我更改的文件,如果您需要任何其他信息,请告诉我,我会立即包含它。

https://github.com/sandilukez/cms-django-cookie

我尝试了所有我能在网上找到的东西,但没有成功!

最佳答案

上面的答案很接近,至少是问题所在,但答案 X_FRAME_OPTIONS = "ALLOWALL" 可能会导致安全问题。 正如 django 文档中提到的那样

Modern browsers honor the X-Frame-Options HTTP header that indicates whether or not a resource is allowed to load within a frame or iframe. If the response contains the header with a value of SAMEORIGIN then the browser will only load the resource in a frame if the request originated from the same site.

为了使 django cms 能够在网站内打开 iframe,我们应该在我们的设置中放置 X_FRAME_OPTIONS = 'SAMEORIGIN'。这样我们就不允许其他网站将我们的网站包含为 iframe 但让 django cms 正常工作。 有关详细信息,请参阅相关文档:https://docs.djangoproject.com/en/3.1/ref/clickjacking/

关于Django CMS - cookie cutter : The form could not be loaded. 请检查服务器是否正常运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57909645/

相关文章:

django - 无法反转 django.contrib.admin.sites.index

python - render_to_response 给出 TemplateDoesNotExist

php - 访问使用 jQuery 的 load() 函数加载的 html 内容

django cms - 通过 slug 解析页面 url

django - 如何在 Django-CMS 中停用 WYMeditor 以仅使用纯 HTML?

python - 将 Django 调度程序应用程序与您自己的模型一起使用

django - 比较 django TestCase 中的查询集

security - 对不同CMS的安全性有研究吗?

php - 操纵 Joomla 内容

django - 如何从 Django 模板中的页面迭代 cms 插件实例?