Django 如何创建 request.session 并与 WSGI 交互?
我正在使用 SWFUpload 和 Django,我注意到身份验证往往会被破坏。
有一个部分阻碍了我,我正在寻找方向,而不是解决方案,因为我认为解决方案尚不可用。 (所以我正在制作它。)
我需要知道 Django 如何创建 WSGI 请求对象以及如何处理它。
查看 django 的源代码后,似乎 csrf 是通过 WSGIobject 完成的,WSGIobject 附加了适当的 cookies。除非特别说明,Flash 帖子自然不支持此功能。 SWFUpload 提供了通过插件在 post 参数中发送 cookie 数据的功能,但是我想通过 URLRequest 对象上的标头发送它们。 (以便 Auth-Middleware 和 CSRF-Middleware 可以看到它。)
我的目标是升级 SWFUpload 以发送包含我传递的任何对象的值的标头。对我来说最困难的部分是弄清楚如何解释这些标头。
Django如何创建request.META对象? | request.session 对象是在哪里创建的?
我现在正在阅读 WSGInterface,但我想加速这项研究。谢谢!
I'm working with SWFUpload and Django, and I've noticed that authentication tends to break.
There is one part that is holding me up and I'm looking for direction more then a solution as I think know the solution is not yet available. (So I'm making it. )
I need to know how Django creates the WSGI request-object and how it's handled.
After looking at the source of django, it seems that csrf is done via the WSGIobject which have the appropriate cookeis appended to it. Naturally flash posts do not support this unless specified. SWFUpload offers the ability to send cookie data in the post params via a plugin, however I'd like to send them via headers on the URLRequest object. ( So that the Auth-Middleware and CSRF-Middleware can see it. )
My goal is to upgrade SWFUpload to send headers containing the values for what ever objects I pass it. The hard part for me is to figure out how those headers will be interpreted.
How does Django create the request.META object? | Where is the request.session object created?
I'm reading up on the WSGInterface now, but I'd like to accelerate this research. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您正在寻找的是 django.core。处理程序.wsgi。
I believe what you're looking for is django.core.handlers.wsgi.