Bri*_*unt 6 python google-app-engine python-2.7
GAE 1.5.5看起来有一些优秀的,等待很久的功能.但是,他们还没有为我工作.
我已经下载并安装了GAE 1.5.5,并且正在使用退化的"AAA"应用程序进行测试.
这是我的app.yaml(已经进行了各种测试).
application: AAA # mystical creation.
version: alpha-1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /media
static_dir: media/
- url: /favicon.ico
static_files: media/images/favicon.ico
upload: media/images/favicon.ico
- url: /admin
script: AAA.app
login: admin
- url: /.*
script: AAA.app
skip_files:
- ^(.*/)?app\.yaml
libraries:
- name: django
version: "1.2"
- name: jinja2
version: latest
- name: yaml
version: latest
Run Code Online (Sandbox Code Playgroud)
我在Mac OS X Lion(10.7.1)上运行它.
我假设我实际上并没有使用Python 2.7运行时,尽管在app.yaml中声明使用它.我不太确定如何验证这个理论,但我遇到的错误与它一致.这些错误再现如下.
如果未设置Google App Engine的Python路径,则应用引擎将使用Python 2.6.6运行.
为了解决这个问题,我将Python Path设置/usr/bin/python2.7为Google App Engine首选项.
我收到以下错误:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver.py in
GetParentPackage(self=<google.appengine.tools.dev_appserver.HardenedModulesHook
object>, fullname='AAA.app')
2334
2335 if self.find_module(fullname) is None:
=> 2336 raise ImportError('Could not find module %s' %
fullname)
2337
2338 return self._module_dict[parent_module_fullname]
builtin ImportError = <type 'exceptions.ImportError'>, fullname =
'AAA.app'
<type 'exceptions.ImportError'>: Could not find module AAA.app
args = ('Could not find module AAA.app',)
message = 'Could not find module AAA.app'
Run Code Online (Sandbox Code Playgroud)
我在哪里试过AAA.app:
from google.appengine.dist import use_library
use_library('django', '1.2') # otherwise we still get django 0.96
from django.core.handlers import wsgi
app = wsgi.WSGIHandler()
Run Code Online (Sandbox Code Playgroud)
__init__.py# same content as above
Run Code Online (Sandbox Code Playgroud)
# same content as above
Run Code Online (Sandbox Code Playgroud)
请注意,我可以通过app.yaml和AAA.py修改后继续运行CGI, 经过必要的修改.但是,这样做会导致以下错误:
当我跑步时,import jinja2我得到一个ImportError.
无:
from google.appengine.dist import use_library
use_library('django', '1.2')
Run Code Online (Sandbox Code Playgroud)
我最终得到了Django 0.96.
鉴于以下内容:
我相信我并没有真正使用Python 2.7 GAE运行时(即GAE 1.5.5 SDK中忽略了app.yaml声明).
我希望上面的内容是一个有用的描述,我很感激任何关于这里可能发生的事情的想法 - 以及潜在的解决方案.
我有同样的问题,但在Windows上,我发布在Google App Engine论坛上,这是我得到的官方回复:
Dev服务器还不支持2.7.目前,测试基于2.7的代码的唯一方法是使用appengine