python基础-跨域问题
2024-08-31 20:46:16
跨域
-- 浏览器的同源策略 阻止ajax请求 不阻止src请求
-- jsonp
-- 我们利用src发送请求
-- core
-- class MyCore(MiddlewareMixin):
def process_response(self, request, response):
response['Access-Control-Allow-Origin'] = "*"
if request.method == "OPTIONS":
# 复杂请求 预检
response['Access-Control-Allow-Headers'] = "Content-Type"
response['Access-Control-Allow-Methods'] = "POST, DELETE, PUT"
return response
最新文章
- Palindrome Pairs
- rename 快速移动文件或者文件夹
- html5网页动画总结--jQuery旋转插件jqueryrotate
- A*算法详解 BZOJ 1085骑士精神
- HTML5程序设计--SVG
- h2database源码浅析:事务、两阶段提交
- Android应用开发学习之画廊视图
- MYSQL id 自动加1
- 混入模式(max-in)实现继承
- Python学习之编写登陆接口(Day1,作业一)
- LeetCode OJ 35. Search Insert Position
- DNA序列对齐问题
- TP 3.2.3 接入PHPMailer
- CSS布局(四) float详解
- 基于androidpn客户端修改的AndroidPNClient
- restTemplate设置访问超时
- Percona-Toolkit 之 pt-online-schema-change 总结
- vue-router2.x使用入门
- html学习_html5 新增标签和属性
- 如何借助 HealthKit 打造一款健身应用?