Google App Engine CMS系统的搭建

简介

圣诞假期期间试着使用Google App Engine搭建了一个CMS系统,挺简单的,而且稳定和免费。把搭建过程Blog下来。

 

软件下载

下载Python

下载ActivePython 2.5.4.4并安装。

http://www.activestate.com/activepython/downloads/

 

下载Google App Engine SDK

下载Google App Engine SDK for Python,我使用Python而不是Java。

http://code.google.com/appengine/downloads.html

 

下载App Engine Site Creator

我使用开源软件App Engine Site Creator,下载并解压到本地目录

http://code.google.com/p/app-engine-site-creator/wiki/TechnicalOverview

 

定制

修改configuration.py

configuration.py用于定制App Engine Site Creator系统的,代码如下:

#!/usr/bin/python2.5
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

"""System-wide configuration variables."""

import datetime


# This HTML block will be printed in the footer of every page.
FOOTER_HTML = (
'Copyright @ Lin Software 2009 | '
'Designed By Jake Lin'
'<img src="http://code.google.com/appengine/images/appengine-noborder-120x30.gif"'
'alt="Powered by Google App Engine" />'
)


# File caching controls
FILE_CACHE_CONTROL = 'private, max-age=86400'
FILE_CACHE_TIME = datetime.timedelta(days=1)


# Title for the website
SYSTEM_TITLE = 'Lin Software'

# Description for the website
SYSTEM_DESCRIPTION = 'Welcome to Lin Software site'

# Unique identifier from Google Analytics (ie. UA-xxxxxxx-x)
ANALYTICS_ID = 'UA-xxx'

# Name of theme for your site, must be located in
# 'templates/themes/{FOLDER NAME}' where your customized
# base and page files should be located
SYSTEM_THEME_NAME = 'nautica05'

 

 

FOOTER_HTML是所有页面的页脚。如下图

google-app-engine-cms-1

还需要定义SYSTEM_TITLE和SYSTEM_DESCRIPTION。 ANALYTICS_ID用于Google Analytics,不是必须的。

 

修改app.yaml

app.yaml定义Google App Engine的应用的信息。

application: linsoftwaresite
version: 2
runtime: python
api_version: 1

default_expiration: "1d"

handlers:
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico

- url: /static/images/fileicons/.*
script: zip_handler.py

- url: /fckeditor/.*
script: zip_handler.py

- url: /static
static_dir: static

- url: /admin/.*
script: main.py
login: required

- url: /.*
script: main.py



skip_files: |
^(.*/)?(
(app\.yaml)|
(app\.yml)|
(index\.yaml)|
(index\.yml)|
(#.*#)|
(.*~)|
(.*\.py[co])|
(.*/RCS/.*)|
(\..*)|
(dev/.*)|
(tests/.*)|
(docs/.*)|
)$

我的应用的ID是linsoftwaresite。所以把application修改为linsoftwaresite。

 

测试

使用Google App Engine Launcher测试定制的CMS。增加一个新应用,指向App Engine Site Creator解压的本地目录。

google-app-engine-cms-2

点击Browse可以测试。

google-app-engine-cms-3

 

部署

使用Google App Engine Launcher可以把应用不是到Google App Engine上。

配置应用属性

google-app-engine-cms

首先需要配置应用的属性,Deployment Server 需要填写 appengine.google.com开始我填错了,填了自己应用的网址,一直没有成功。

上传

google-app-engine-cms-4

点击"Deploy”,填写Email和密码上传应用。

 

预览

google-app-engine-cms-5

可以通过www.linsoftware.com来访问,但是可能国内给河蟹了,所以请使用linsoftwaresite.appspot.com来预览。

关于Google App Engine的开发可以参考一下下面的链接,不错的教材。

http://code.google.com/appengine/docs/python/gettingstarted/introduction.html

posted @ 2010-01-03 10:44  Jake Lin  阅读(6274)  评论(15编辑  收藏  举报