« Aha | Main | Debugging Google AppEngine with PyDev in Eclipse »

April 10, 2008

Getting Started on Google App Engine with Flex and PyAMF (2)

UPDATE: For setting up PyAMF I recommend using this article written over on PyAMF. This original post was written before a patch was created. And there instructions will be more up to date and maintained.

 

The previous article on this topic can be found here.

I’m also shamelessy pulling from this article. It almost got me there, but there was one thing noted below that I needed to do. 

1. Download pyamf.

2. Now unzip the pyamf into a directory ( i went with c:/pyamf ) and browse to it from the command prompt. When you get to the source folder run “ez_setup.py”.

3. Now complete the following steps ( original reference can be found here )

  • Download and unpack pyAMF-0.2
  • Download fpconst and put it in pyAMF-0.2/pyamf
  • Delete the file pyAMF-0.2/pyamf/adapters/__init__.py
  • Comment out the line register_adapters(); at the end of pyAMF-0.2/pyamf/__init__.py

 (I did these steps and found I still needed to comment out line 26 in the pyAMF-0.2/pyamf/__init__.py that looks like:  from pyamf.adapters import register_adapters )

4. After that is completed, go back to your command prompt and run “setup.py install”

5. Afterwards in the directory where you downloaded pyamf you should have a directory that has a dist directory under that. Add the .egg in the dist directory to your System – PYTHONPATH. in windows > prefs > PyDev > Interepretor just like we did for the google.zip file above. ( This will bring in code completion support )

6. From the command prompt start your server   /appengine/dev_appserver.py {app name}

7. Browse to http://localhost:8080/

if everything’s set up and running properly you’ll see something like

400 Bad Request

To access this PyAMF gateway you must use POST requests (GET received)


 


 


8. Finally, create a flex app.  Below is the code I used. You should be able to drop it in your flex app file. If everything works you can use the appcfg.py commands to upload your application and point your endpoint to your new application url.  


Pyamfcode1


 


This is by no means complete and I hope to get more examples up and running soon. If you have any questions feel free to comment or email me. I’ll be posting on how to debug python apps from eclipse when making calls from flex and also some other topics that have been floating around. Like Google Authentication.


 


 


 


 


 


 



 

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/2357234/27962132

Listed below are links to weblogs that reference Getting Started on Google App Engine with Flex and PyAMF (2):

Comments

Have you had a chance to push this live? My worry is with size of the resulting swf being too large for gae's static file serving.

Wow.

I just posted that sample at pyamf.org a few hours ago, and already someone has tried it. =)

I avoided running ez_setup because I was afraid it would install modules that weren't compatible with Google. Have you tried deploying to appspot? Also, did you test it after an ez_install without deleting the dependencies? As long as you have the Importing class working, there shouldn't be a need to delete the references to it from PyAMF.

Hi,

I have updated http://pyamf.org/wiki/GoogleAppEngine accordingly, thanks for the info. The Importing module is required by the Adapter Framework (check http://pyamf.org/wiki/AdapterFramework for more details) and can be safely disabled (as it doesn't do very much atm).

A rethink may be required on how to supply a plugin api for projects like Django, SQLAlchemy etc.

We also have a ticket tracking the development of this, see http://pyamf.org/ticket/237

@Brett, I published my python code and pointed my flex remote object to work on google and it worked fine. I'm not worried about the swf because you can host those anywhere (think S3) and it could be an air app as well.

@b, yes, i was reading your post right when you modified it. I couldn't get it to work without deleting the dependencies. I did not try it without running an ez_install. Basically I launched my dev_appserver.py from eclipse debug and walked through the code till I got no more errors. ;)

@Nick, thanks for the info. I, along with probably alot of flex developers are new to python development. So the more references the better. I really appreciate the project you guys put together with PyAMF, and hopefully I can contribute in the future.

Worked like a charm. Thanks a million!

Post a comment

If you have a TypeKey or TypePad account, please Sign In