2008年12月29日 星期一

google blogger data api & app engine


get project code:
svn co http://google-app-engine-samples.googlecode.com/svn/trunk/gdata_feedfetcher

install:
1. get gdata library
2. copy gdata and atom directories of gdata-python-client library into project directory


get blogs updated at today:
ex: if today is 2008-12-30, want to get blogs with tag "apple command"
from url:
http://deeplyloveapple.blogspot.com/feeds/posts/default/-/apple%20command?updated-min=2008-12-30&orderby=updated



2008年9月4日 星期四

URL mapping in app engine

defined in app.yaml

app.yaml defines which handler script will  handle the request(URL)

2008年8月29日 星期五

using django with app engine

1. create django project
   django-admin.py startproject Test

2. add main.py in project:
# Google App Engine imports.
from google.appengine.ext.webapp import util

from django.core.management import setup_environ
import settings

setup_environ(settings)

# Force Django to reload its settings.
from django.conf import settings
settings._target = None

import django.core.handlers.wsgi
import django.core.signals
import django.db
import django.dispatch.dispatcher


# Unregister the rollback event handler.
django.dispatch.dispatcher.disconnect(
    django.db._rollback_on_exception,
    django.core.signals.got_request_exception)

def main():
  # Create a Django application for WSGI.
  application = django.core.handlers.wsgi.WSGIHandler()

  # Run the WSGI CGI handler with that application.
  util.run_wsgi_app(application)

if __name__ == '__main__':
  main()

3. add app.yaml in project
application: test
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
  script: main.py

4. dev_appserver.py  Test

2008年8月28日 星期四

webpage about django & app engine

http://www.42topics.com/dumps/django/docs.html

create application on app engine

1. create an application from http://appengine.google.com/
    application identifier must be the same as application in app.yaml

2. upload application
    appcfg.py  update helloworld

3. by default,
    the application url is  http://helloworld.appspot.com/

using static files

using css:
add  following lines in yaml
- url: /stylesheets
  static_dir: stylesheets

add a directory stylesheets under project directory 
css files are in this directory

add following lines in html
<head>
   <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
 </head>