V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
gooesberry
V2EX  ›  Django

有没有做 python django 开发的?我在后台装了个 ckeditor 结果 sever error 500 了,求大神帮忙!

  •  
  •   gooesberry · 2016-12-19 17:43:43 +08:00 · 4277 次点击
    这是一个创建于 2930 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用 django 写了一个网站,然后后台的编辑器太简陋了,于是就装了富文本编辑器 ckeditor 并且设置了上传图片到服务器.在本地测试没有问题,部署到服务器 ubuntu ,上传图片就不行了,本应该显示图片的框框里结果显示 server error 500 错误。 由于我在 stackoverflow 上提问了,所以就不重写一次了。 会的朋友帮看看,感谢! http://stackoverflow.com/questions/41219168/uploading-images-use-django-ckeditor-getting-server-error500

    I have been struggling for the problem for two days. Unfortunately, i still have no idea to solve it due to my poor knowledge. So i have to come here asking for help. Very appreciate !

    enter image description here

    I want to write a website as my blog and use Django to implement it. To develop this website, i have to use rich text editor, so i use CKeditor on admin panel. Here is the link of Ckeditor source code on github. https://github.com/django-ckeditor/django-ckeditor

    To upload images using ckeditor widget , i edited this file../static/ckeditor/ckeditor/plugins/image/di alogs/image.js so it can display the images upload button.

    id:"Upload",hidden:!0 I also added upload url in config.js. After that, i set routing in the urls.py and added a view function in views.py. Everything was ok on my computer. however, after i deployed it to website server i got server error(500) during uploading a image by ckeditor . Ckeditor widget can not return the urls but i can find the images on server which i uploaded by ckeditor.

    8 条回复    2016-12-19 22:19:38 +08:00
    wenymedia
        1
    wenymedia  
       2016-12-19 17:55:25 +08:00 via Android
    检查写入权限
    glasslion
        2
    glasslion  
       2016-12-19 18:02:36 +08:00
    配下 log, 看看错误堆栈吧. 光给个 500 很难定位
    tairan2006
        3
    tairan2006  
       2016-12-19 18:13:20 +08:00
    可能是权限问题吧,你把 settings.py 里面的`debug=True`打开,会看到更多有用信息。。
    gooesberry
        4
    gooesberry  
    OP
       2016-12-19 18:23:22 +08:00
    @tairan2006 @glasslion @wenymedia 在服务器能找到文件,说明可以上传,只是返回 url 的时候出错, debug=True 开了,依然也只显示 500.怎么配置 log 呢?
    zzlettle
        5
    zzlettle  
       2016-12-19 20:59:42 +08:00
    正好我前段时间专门做了一期 django 跟编辑器的整合的视频教程
    地址在这里
    http://www.fanhuaxiu.com/article/840/
    jarlyyn
        6
    jarlyyn  
       2016-12-19 21:02:48 +08:00
    1.ckeditor 是一个前端插件
    2.文件上传部分我用的时候是自己写的, Js 对接上去的。
    syv2
        7
    syv2  
       2016-12-19 22:16:10 +08:00
    如果出错的话,即便异常被捕获了,之后的那个 res 里引用的 file_name 是没定义的
    freestyle
        8
    freestyle  
       2016-12-19 22:19:38 +08:00
    权限问题.
    ls -l 看一下图片上传的目的目录的所有者和权限
    再 ps -aef 对比你 django wsgi server 的用户组
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   953 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:29 · PVG 05:29 · LAX 13:29 · JFK 16:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.