1. David Wolever
  2. django-amf-gateway

Source

django-amf-gateway /

Filename Size Date modified Message
django_amf_gateway
django_example
flex_example
113 B
1.0 KB
90 B
1.6 KB
1.4 KB

django-amf-gateway makes it easy for Django apps to provide AMF services.

After PyAMF[0] is installed, only five steps are required to setup an AMF gateway:

0: Put the 'django_amf_gateway' directory somewhere in $PYTHONPATH

1: Add an enty to INSTALLED_APPS:

INSTALLED_APPS = (
... 'django_amf_gateway', ...

)

2: Set AMF_NAMESPACE in settings.py:

AMF_NAMESPACE = "my_namespace"

2: Add two URLs to urls.py:

(r'^gateway/', 'django_amf_gateway.amf_gateway'), (r'^crossdomain.xml$', 'django_amf_gateway.render_crossdomain'),
3: Create the file 'amf_service.py' in every application you want to

publish:

from django_amf_gateway import register_amf_service from . import models as m

class EchoService(object):
def echo(self, arg):
return arg
def spamWithEggs(self, eggs):
s = m.Spam() s.eggs = eggs return s

register_amf_service('echo', EchoService, [ m.Spam ])

And you're done!

You can see the django_example directory to see an example of a working Django server, and the flex_example directory for a Flex client.

= Options

AMF_GATEWAY_KWARGS::
kwargs which will be passed to DjangoGateway.
AMF_NAMESPACE::

A namespace which will be used for all classes registered with the classes argument to register_amf_service. The default is {}. A possible value is:

AMF_GATEWAY_KWARGS = {
'strict': False, 'expose_request': False, 'logger': logging,

}

[0]: http://pyamf.org/