django-flashpolicies 1.10¶
This application provides management of Flash cross-domain policies (which are required for Flash content to access information across domains) for Django-powered sites. Cross-domain policies are represented by an XML file format, and this application generates and serves the appropriate XML.
In many cases, the same policy file will also be understood by Microsoft’s Silverlight browser plugin, which supports the Adobe Flash format as a fallback in the absence of a file in its own native cross-domain policy format.
In the most common case, you’ll set up one URL pattern, pointing the
URL /crossdomain.xml
to the view
flashpolicies.views.allow_domains()
and passing a list of
domains from which you want to allow access. For example, to allow
access from Flash content served from media.example.com
, you could
place the following in the root URLconf of your Django site:
from django.conf.urls import url
from flashpolicies.views import allow_domains
urlpatterns = [
# ...your other URL patterns here...
url(r'^crossdomain.xml$',
allow_domains,
{'domains': ['media.example.com']}),
]
Or, using Django 2.0 with the new path
URL helper:
from django.conf.urls import path
from flashpolicies.views import allow_domains
urlpatterns = [
# ...your other URL patterns here...
path('crossdomain.xml',
allow_domains,
{'domains': ['media.example.com']}),
]