关于 DjangoUeditor 上传图片图片失败,csrf token missing or incorrect 的解决办法
Forbidden (CSRF token missing or incorrect.): /ueditor/controller/
[27/Jun/2017 23:49:25] "POST /ueditor/controller/?imagePathFormat=courses%2Fueditor%2F&filePathFormat=courses%2Fueditor%2F&action=uploadvideo&encode=utf-8 HTTP/1.1" 403 2266
错误原因:get_ueditor_controller() 方法没有csrf保护
解决办法:
在ueditor源码中的views.py文件中找到get_ueditor_controller函数,然后添加@csrf_exempt 装饰器
@csrf_exempt
def get_ueditor_controller(request):
"""获取ueditor的后端URL地址 """ action=request.GET.get("action","")
reponseAction={
"config":get_ueditor_settings,
"uploadimage":UploadFile,
"uploadscrawl":UploadFile,
"uploadvideo":UploadFile,
"uploadfile":UploadFile,
"catchimage":catcher_remote_image,
"listimage":list_files,
"listfile":list_files
}
return reponseAction[action](request)
关于 DjangoUeditor 上传图片图片失败,csrf token missing or incorrect 的解决办法的更多相关文章
- Forbidden (CSRF token missing or incorrect.):错误解决办法
在JS中,使用post方法提交数据到后台,出现错误: Forbidden (CSRF token missing or incorrect.):.........; 解决办法: 在页面导入JS的位置, ...
- "CSRF token missing or incorrect."的解决方法.
现象: Forbidden (403)CSRF verification failed. Request aborted.HelpReason given for failure:CSRF token ...
- django rest framework csrf failed csrf token missing or incorrect
django rest framework csrf failed csrf token missing or incorrect REST_FRAMEWORK = { 'DEFAULT_AUTHEN ...
- django CSRF token missing or incorrect
django 异步请求时提示403 按照一般情况权限问题,python文件没有问题,仔细看了下response里有一句 CSRF token missing or incorrect.这个肯定是因为安 ...
- 关于django1.7.7使用ajax后出现“CSRF token missing or incorrect”问题的解决办法
最近使用Python3.3.25和django1.7.7开发公司项目,在使用ajax来post数据时,居然一直提示:403错误,原因是“CSRF token missing or incorrect” ...
- 对于 前端请求Django 后端服务出现403 Forbidden (CSRF token missing or incorrect.) 问题的解析
Django中使用ajax post向後臺傳送資料時403 Forbidden (CSRF token missing or incorrect.):的解決辦法 在Django中使用ajax post ...
- django前后端分离403 csrf token missing or incorrect
根据这个链接https://stackoverflow.com/a/26639895 这是一个django的跨域访问问题. django,会对合法的跨域访问做这样的检验,cookies里面存储的'cs ...
- Forbidden (CSRF token missing or incorrect.):
CSRF令牌失效或丢失,Ajax请求页面报错(403 Forbidden ) csrftoken存在 页面响应为CSRF验证失败请求被中断,经过测试,该错误并非是没有在表单中加入{% csrf_tok ...
- django中使用POST方法 使用ajax后出现“CSRF token missing or incorrect”
这个是因为在django的ajax中默认添加了token,因此需要在cookie中增加token头信息. 首先使用JavaScript函数获取token: function getCookie(nam ...
随机推荐
- UVALive 7464 Robots(模拟)
7464Robots Write a program to collect data from robots. We are given two sets of robotsX=fX1;:::;Xmg ...
- Daily Scrum10 11.14
昨天的任务已经完成,但是我们在完成任务的过程中确实遇到了困难.昨天我们发现无法连接sqlserver的时候,给罗杰老师发了邮件.老师也给我们提出了建议,给我们提供了一些参考.所以今天大家都在研究如何解 ...
- AloneQIan---第一次作业
小学生的噩梦 一.估计与实际 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 600 720 • Estim ...
- 自学iOS-获取当前时间
NSDate * senddate=[NSDate date]; NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init]; [dat ...
- BATA冲刺准备
目录 第一部分 调研,评测 福大助手的bug IOS端 Android端 福大助手结构体系的思维导图 为什么开发人员没有发现这个bug 假设团队开发这款app,应注意哪些方面(架构.部署运维.微服务等 ...
- 面向对象程序设计第三次作业-Calculator
题目: 最终代码: Scan.h: Print.h: Calaulator.cpp: 解题过程 看到题目后,在查询之后明白了这是多文件的题目,然后通过翁凯老师的视频讲解知道了.h和.cpp文件的区别和 ...
- matconvnet编译
1.安装matconvnet 网上教程很多 2.编译 cd matconvnet/ addpath matlab/ vl_compilenn('enableGpu',true,'cudaRoot',' ...
- HDU 4336 Card Collector 期望dp+状压
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4336 Card Collector Time Limit: 2000/1000 MS (Java/O ...
- LeetCode题解:(221) Maximal Square
题目说明 Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's a ...
- Win2019 IPV6 支持存在问题
1. 昨天晚上尝试 使用IPV6进行Oracle与SQLserver 的链接测试.从晚上六点到晚上八点测试环境一直不通. 后来换了服务器之后发现立即就可以了. 经过简单确认 怀疑Win server ...