有没有办法将我的 Flex 构建器绑定到我的 Django 应用程序
我正在尝试创建简单的 Flex 应用程序,它使用 django 作为后端部分。 有一个问题:
通常当我运行应用程序时,Flex Builder 在本地 PC 上的目录中创建一个文件,然后打开浏览器并指向它。 一切都很好,但是当我决定通过 xml 数据提供程序将 django 服务器链接到 Flex 应用程序时,我开始遇到安全错误。 (与缺少 crossdomain.xml 有关)。 当我创建文件并将其放在服务器上时:
<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="http://127.0.0.1:8000"/>
<allow-access-from domain="127.0.0.1"/>
</cross-domain-policy>
然后再次尝试该应用程序,我的 FB 控制台中出现错误错误:请求资源位于 http://127.0.0.1:8000/go/active/ 来自 file:///Users/oleg/Documents/FB3/usersList/bin-debug/usersList 的请求者由于缺乏策略文件权限,.swf 被拒绝。
我不知道如何修复该错误。 但问题是有没有办法配置 FB3 将我的 swf 文件直接放入服务器,这样我就不需要任何跨域?
谢谢 奥列格
I am trying to create simple flex application, which uses django as a back-end part. Have a question:
Usually when I run my application Flex Builder creates a file in a directory on my local PC and then opens a browser and points to it. Everything was fine, but when I decided to link django server to flex applications via xml data providers I started to get security errors. (Related to absence of crossdomain.xml). When I created the file and put it on the server:
<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="http://127.0.0.1:8000"/>
<allow-access-from domain="127.0.0.1"/>
</cross-domain-policy>
Then tried the application again, I got error in console of my FB Error: Request for resource at http://127.0.0.1:8000/go/active/ by requestor from file:///Users/oleg/Documents/FB3/usersList/bin-debug/usersList.swf is denied due to lack of policy file permissions.
I don't know how to fix the error. But also the question is there a way to configure FB3 to put my swf files to the server directly, so I will not need any crossdomain?
Thanks
Oleg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们为此苦苦挣扎了很多。 Flex 的安全功能并没有给我留下很好的印象,但也许我们只是与 Adobe 的开发人员考虑了不同的方法。 对我们有用的解决方案是从同一主机和端口同时提供 SWF 和动态数据。
在我们的开发框中,我们告诉 Apache 从工作区中的目录提供 SWF,并从应用程序的本地副本提供动态数据。 当我们推送到生产环境时,SWF 和应用程序会同时推送到同一虚拟主机。
如果这对您来说不方便,Apache
ProxyPass
指令可用于使 Apache 成为其他服务器的前端。 我没有在生产中使用过它,但它对于开发人员设置来说非常方便。We struggled with this a lot. The Flex security stuff didn't strike me as well built, but perhaps we just had different approaches in mind than Adobe's developers. The solution that worked for us was to serve both the SWF and the dynamic data from the same host and port.
On our development boxes, we tell Apache to serve the SWF from a directory in the workspace, and the dynamic data from a local copy of the app. When we push to production, SWF and app get pushed simultaneously to the same virtual host.
If that's inconvenient for you, the Apache
ProxyPass
directive can be used to make Apache front for other servers. I've not used that in production, but it's been very handy for developer setups.我不知道如何让 FlexBuilder 自动部署更改后的 SWF; 您当然可以研究一种自动化方法(如 Maven 和 Flex-Mojos)来实现这一目标。
也就是说,消除该错误通常只需添加 策略文件 到服务器。
I don't know a way to get FlexBuilder to automatically deploy your changed SWF; you could certainly look into an automation approach (like Maven and Flex-Mojos) to make that happen.
That said, getting rid of that error is usually just a matter of adding a policy file to the server.
第二个错误是因为您尝试从“文件”位置获取 http 资源而引起的。 我的建议是更改 Flex Builder 项目,使其输出到 Django 网站内的某个位置,而不是 flex-bin 目录。 可以在项目的属性对话框中更改此设置。 然后,您应该能够让前端和后端共享相同的协议和域。
The second error is caused because you're trying to fetch http resources from a "file" location. My recommendation is that you change your Flex Builder project so it outputs to a location within the Django web site, rather than to the flex-bin directory. This setting can be changed in the properties dialog of the project. Then, you should be able to have your front-end and back-end share the same protocol and domain.