admin管理员组文章数量:1530044
版本:Django2.1 python3.6 CentOS6.8 FDFS
在admin后台管理测试文件存储类,改变了Django的存储行为,把文件存储到FDFS中,一切进行顺利,但是在点击“保存”时,弹出页面,就只有一句话,就是”A server error occurred. Please contact the administrator”,我一头雾水,这也不是错误,也没有什么信息,在网上搜索一下,也没啥解决方法,只知道是setting.py文件的配置出错了。
改变Django的存储行为在setting.py就配置了一句
DEFAULT_FILE_STORAGE = ‘utils.fdfs.storage.FDFSStorage’(这是自己写的方法)
这个是固定写法,也没啥好改的,但是就是这里出错了!!!
我想我大概是程式有错误吧,但最后检查了程序也没有错。后来我直接在终端进行FDFS存储测试,输出测试程序
from fdfs_client.client import Fdfs_client
client = Fdfs_client(‘/etc/fdfs/client.conf’)
ret = client.upload_by_filename(/home/cole/python/test/test1.py’)
然后报警了!
ret=client.upload_by_filename(‘/home/cole/python/test/test1.py’)
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
[-] Error: 111 connect to 192.168.226.3:22122. Connection refused.
这下终于水落石出了,原来是我没有开户FDFS服务!
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf
开户FDFS服务之后,一切正常!
本文标签: ErrorServerdjangoadministratorContact
版权声明:本文标题:Django - A server error occurred. Please contact the administrator 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1726641978a1079746.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论