How to use a public IP address with Google App Engine development server

And just when I thought that setting up Apache, mod_python and Lighty with Django was cool, and I haven't even started playing with mod_wsgi or nginx (the powerful Russian HTTP server, pronounced engine X) came the requirement to move the Django application I'm developing for Facebook to Google App Engine, the latest, and it seems the coolest, player in the cloud computing arena.

While my code was running on a pure Django environment I setup the callback url in Facebook's developer application to point to my local server, some simple port forwarding in my router did the trick. Now I wanted to do the same using Google App Engine's development server.

D-Link port forwarding

After having one of my internal IP addresses accesible from the outside Facebook could call my application running at home. I noticed then that Django's development server made Facebook time out and started using my Apache/Lighty setup for development, you may need to setup your max requests per child setting on Apache to do that.

Anyway, I wanted to do the same when I started porting my Django application to Google App Engine (take a look at the App Engine helper for Django) and knew I had to change the way of calling, which usually is like this: helloworld/

I added and to my path to avoid writing long command lines.

Calling the server without parameters shows a list of options, a for changing the IP address and p for the port, hence this should work: -a -p 80 helloworld/

As you can see my private address is If you run that command like that you may get:

socket.error: (13, 'Permission denied')

Oops, permissions. Maybe we need sudo:

sudo -a -p 80 helloworld/

Yep, that works.

Now, if you get this error:

socket.error: (98, 'Address already in use')

some other process is using the address and port you selected. The easiest way to fix this is stopping the web servers you have installed. If you want to know which process is using the address and port run netstat:

netstat -an | grep

where is the private IP address you want to use for Google App Engine's development server.

Gotcha! That's it. You can test by visiting the public IP address assigned to your connection and should see your Google App Engine application running.

That's it. Now point the callback url of your Facebook application to your local development server. I guess you could tell Facebook to use any other port and keep 80 for other uses but I haven't tried it.

I'm almost done with this application and have learned and tested lots of new stuff. Stay tuned as I'll write more on how to hit the road with Django, Facebook and the Google App Engine. See you then.

Participa en la discusión

how did this go when you

how did this go when you tried deploying your application to appengine?

I do not see anything that would like me use a static IP. That is after deploying.

Publica comentarios relevantes, usa español correcto y no envíes publicidad. Creemos discusiones en las que valga la pena participar. Puedes usar Markdown.

Tu comentario