app-engine-patch使用

本文详细介绍如何使用app-engine-patch运行示例项目,并针对在Windows环境下配置Google App Engine SDK及解决常见错误进行了说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先介绍如何运行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创建一个自己的应用
网上这篇文章的翻译很多,但是不知道他们是否都真正操作过,反正我在操作的过程中就总是遇到一个错误:
……
 import _multiprocessing
ImportError: No module named _multiprocessing
这样的错误根本就不知道怎么回事,一大堆GAE的错误。后来只能一点点修改代码来寻找错误。
原来都是出现在template当中,只要你的template调用了这个方法google_login_url 或者google_logout_url的话就报错。
其实在settings.py中增加了
GLOBALTAGS = (
    'ragendja.templatetags.googletags',
)
这句话估计是将googletags当中全局的,然后可以到处调用。但实际上并不是这样,在template的最顶上加上如下的代码就一切正常了
{% load googletags %}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值