Google App Engine 跑 Django-1.2.1

2010年5月26日 | 标签: , ,
废话不多,想在GAE上开发django-1.2应用程序,配置方法如下:
前言:因为GAE的python版本是2.5的,而ubuntu lucid的package list已经不包含python2.5,需要自行下载编译,所以选择了在FreeBSD下进行配置。用ports安装方便,也免得还要翻墙到官网下载。

安装Python2.5

# cd /usr/ports/lang/python25
# make install clean

安装GAE

# cd /usr/ports/www/google-appengine
# make install clean

建立django包以便导入GAE

# curl -L http://www.djangoproject.com/download/1.2.1/tarball/ -o Django-1.2.1.tar.gz
# tar zxvf Django-1.2.1.tar.gz
# cd Django-1.2.1
# zip -r ../django.zip django/
# cd ..
# rm -rf Django*

下载google-app-engine-django支持

# curl -L http://github.com/clones/google-app-engine-django/tarball/master -o google-app-engine-django.tar.gz
# tar zxvf google-app-engine-django.tar.gz
# rm google-app-engine-django.tar.gz
# ln -s /usr/local/share/google-appengine .google_appengine
ps: 注意下划线’_'。FreeBSD是安装在/usr/local/share/目录下,Ubuntu有所不同。

最后你GAE应用程序的目录结构大致如下:

.google_appengine -> /usr/local/share/google-appengine
__init__.py
app.yaml
appengine_django/
django.zip
index.yaml
main.py
manage.py
settings.py
urls.py

运行GAE

#python2.5 manage.py runserver 0.0.0.0:80
django 1.2支持环境建好,你可以开始开发程序了。不过目前不支持django.contrib.contentypes,所以admin也不支持,请注意。
  1. 2010年6月6日13:51

    Use django-nonrel is better since you will have ORM, and thus the admin and all that…

    • 2010年6月6日21:06

      thanks for your information. I will take a look immediately. :P

      anyway, I was using google-language-api-python recently. appreciate your works!