Friday, July 1, 2011

Using google app engine as my CDN

CDN (Content Delivery Network) is a set of servers spread around the world that serves files from the nearest location. we can set up a CDN for our static files on google app engine.

Steps:

1- create an account on Google app engine
appengine.google.com

2- choose a unique application id (for example: MyApp) and create an application on app engine

3- download and install Python on
http://www.python.org/

4- download and install Google App Engine SDK on
http://code.google.com/appengine/downloads.html

5- create a folder the same name as the application id with this structure:
MyApp
     static
        css
        javascript
        images
        pages

6- create a file call app.yaml and put it at the top-level, inside the folder MyApp.
that file has these lines: (identation is important in this file)

application: MyApp
version: 1
runtime: python
api_version: 1

handlers:
-  url: /static
   static_dir: static


7- upload the project files to app engine, using the command line:

cd c:\saeed\test\MyApp
appcfg.py update .

8- check http://MyApp.appspot.com/static/images/blahblah.jpg and enjoy.

0 comments:

Post a Comment