Interactive Python Shell


This document describes how to setup the interactive, stateful Flex shell that runs Python code on the server using the Flex SDK, Google App Engine and Django.

We recommend you don’t run this example on a production server because it exposes major security risks. This example is for educational purposes ;)

A live demo can be found on the PyAMF Google App Engine example page.


Clone the PyAMF repository with:

git clone git:// pyamf
cd doc/tutorials/examples/actionscript/shell

Alternatively, if you just want to have a look, you can browse the example online.


Note: make sure you have Django >= 1.0 installed.


This example uses SQLite to provide session support. First initialise the database by running:

python syncdb

Should output the following:

Creating table django_content_type
Creating table django_session


The remoting gateway for the Adobe Flash Player and Python AMF clients is available on http://localhost:8000/gateway/shell/ when you launch the development server:

python runserver

You should see something like:

Validating models...
0 errors found

Django version 1.1.1, using settings 'python.settings'
Development server is running at
Quit the server with CONTROL-C.


Flash Player

You can simply open the SWF file and it will connect to http://localhost:8000.



The Python AMF client can be started by running the following from the python folder:


You should see something like this for the client:

Connecting to http://localhost:8000/gateway/shell/

Welcome to the PyAMF 0.5.1 Shell Demo!
Python 2.6.4 (r264:75706, Dec 22 2009, 21:55:52)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

You can now use the interpreter as you normally would:

>>> import sys
>>> sys.version
'2.6.4 (r264:75706, Dec 22 2009, 21:55:52) \n[GCC 4.2.1 (Apple Inc. build 5646)]'


When you run python –help it will display the various options available for this example client:

Usage: [options]

  -h, --help            show this help message and exit
  -p PORT, --port=PORT  port number [default: 8000]
  --host=HOST           host address [default: localhost]