A while back I wrote about a library called django-flashpolicies for providing a flexible remoting environment. Essentially, it frees up the root of your django project for whatever content you like while providing a crossdomain policy file there for remoting applications.
That is still one way to go, but as an advance on that, have a look at the Django-amf-gateway library.
The PyAMF team offers info on it as a way to structure a django project such that you can heap on all the apps you want and allow them to share a common http gateway. By simplifying gateway addresses on the server side django-amf-gateway simplifies resource management on the client side.
Works great in applicable cases.
Showing posts with label django-flashpolicies. Show all posts
Showing posts with label django-flashpolicies. Show all posts
Thursday, December 3, 2009
Friday, September 4, 2009
RemoteObject Endpoints in Django
A few quick assumptions about your project:
Thus all web traffic that doesn't match '/media/' is passed to the urls.py for further processing. This is however at odds with your remoting requirements for Flash/Flex. To wit, you need a static file called crossdomain.xml to be available at your site's web root in order to meet the Flash client's security needs.
I looked for a good answer to this and found the Django-Flashpolicies by James Bennett effective and QUICK for this very purpose.
All you will need to do, essentially, is this:
...and you're good to go. Works better than a savage karate chop to the nose, most of the time anyway.
Hope that allows you to move forward quickly.
- It's built with a lightweight proxy server such as nginx or lighttpd
- It utilizes the Django web framework
- It remotes data using some form of ORM
- It is presented via Flash/Flex
#my /etc/nginx/sites-enabled/mysite.conf
server {
listen 50.5.5.50:80;
server_name myurl.com www.myurl.com;
if ($host = 'www.myurl.com' ) {
rewrite ^/(.*)$ http://myurl.com/$1 permanent;
}
location / {
proxy_pass http://127.0.0.1:80/;
include /etc/nginx/proxy.conf;
}
location /media/ {
root /home/django/domains/myurl.com/public_html/;
}
}
Thus all web traffic that doesn't match '/media/' is passed to the urls.py for further processing. This is however at odds with your remoting requirements for Flash/Flex. To wit, you need a static file called crossdomain.xml to be available at your site's web root in order to meet the Flash client's security needs.
I looked for a good answer to this and found the Django-Flashpolicies by James Bennett effective and QUICK for this very purpose.
All you will need to do, essentially, is this:
easy_install django-flashpolicies
...and this...
url(r^'crossdomain.xml$',
'flashpolicies.views.simple',
{'domains': ['media.example.com', 'api.example.com']}),
...and you're good to go. Works better than a savage karate chop to the nose, most of the time anyway.
Hope that allows you to move forward quickly.
Labels:
crossdomain,
django,
django-flashpolicies,
flash,
flex 3,
nginx,
python
Subscribe to:
Posts (Atom)