Django和wysiwyg编辑器(summernote)有时会加载

时间:2014-02-20 11:14:34

标签: django wysiwyg summernote

我在设置https://github.com/lqez/django-summernote时遇到问题。我按照配置部分中的步骤操作,它与django runserver一起运行很好 - 我在管理页面中有夏令营等。但是当我将它添加到公共服务器时,它有时会加载。 当我在管理页面中按F5时,我可以看到有时候夏天加载,有时它不会。在nginx-error.log中,我有这条消息,当它没有加载时:

*ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /admin/django_summernote/attachment/      HTTP/1.1" 200 3347 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)    Chrome/32.0.1700.107 Safari/537.36"

我得到类似的东西:

Not Found

The requested URL /admin/django_summernote/attachment/ was not found on this server.

以及加载时的内容:

    *ip* - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/css/base.css HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/css/changelists.css HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/js/admin/RelatedObjectLookups.js HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip* - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/js/core.js HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
*ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/js/jquery.min.js HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/js/jquery.init.js HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip* - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/js/actions.min.js HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip*  - - [20/Feb/2014:12:00:56 +0000] "GET /admin/jsi18n/ HTTP/1.1" 200 2384 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
    *ip* - - [20/Feb/2014:12:00:56 +0000] "GET /static/admin/img/icon_searchbox.png HTTP/1.1" 304 0 "http://domain.eu/admin/django_summernote/attachment/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"

我真的很困惑,因为它已正确安装并且与django runserver配合得很好。当它正确加载时,它工作得很好。我的静态目录也有这个文件:

`-- django_summernote
    |-- SOURCE
    |-- django_summernote.css
    |-- jquery.fileupload.js
    |-- jquery.iframe-transport.js
    |-- jquery.ui.widget.js
    |-- lang
    |-- summernote.css
    `-- summernote.min.js

由于

1 个答案:

答案 0 :(得分:0)

当您使用runserver运行django项目时,它必须是调试模式。 如果django在调试模式下运行,则通过urls.py提供静态文件可以正常工作。但这并没有像debug=False那样按预期工作。

您必须在生产阶段通过Web服务器(如nginx)提供静态文件。请参阅https://docs.djangoproject.com/en/dev/howto/static-files/