app-engine-patch使用

来源:互联网 发布:mac和win10共享文件夹 编辑:程序博客网 时间:2024/05/04 22:09

首先介绍如何运行app-engine-patch的sample project

 

1. Pre-Install
- Python: my python version is 2.6.2
- GAE SDK: installed with GoogleAppEngine-1.3.7.msi. Of course you can install it with other installation, maybe just unzip. But you must add install directory into environment variable path in Windows and make sure its name end with "google_appengine". For example my install directory is "D:/google_appengine/"
2. Install app-engine-patch
 
- In fact you just download its sample project which contains app-engine-patch and other necessary files in common directory.
3. Run sample project
- use command "manage.py runserver" then you may find cannot find GAE SDK. There two ways to solve this issue.
   --create one directory ".google_appengine" under common directory and copy GAE SDK into it.
   --change the file "common/appenginepatch/aecmd.py". You can find one line code below
for path in os.environ.get('PATH', '').replace(';', ':').split(':'):
     replace it with below code
for path in os.environ.get('PATH', '').split(';'):
     then it can find the GAE SDK you just installed.
*Note*: you cannot launch this sample project with GAE Launcher, I don't know the reason.
2. 如何利用sample project创建一个自己的应用
参考这篇文章http://code.google.com/appengine/articles/app-engine-patch.html
网上这篇文章的翻译很多,但是不知道他们是否都真正操作过,反正我在操作的过程中就总是遇到一个错误:
……
 import _multiprocessingImportError: No module named _multiprocessing
这样的错误根本就不知道怎么回事,一大堆GAE的错误。后来只能一点点修改代码来寻找错误。
原来都是出现在template当中,只要你的template调用了这个方法google_login_url 或者google_logout_url的话就报错。
其实在settings.py中增加了
GLOBALTAGS = (    'ragendja.templatetags.googletags',)
这句话估计是将googletags当中全局的,然后可以到处调用。但实际上并不是这样,在template的最顶上加上如下的代码就一切正常了
{% load googletags %}

原创粉丝点击