[英]cannot run appengine-admin on dev_server
I've decided to try out this project: 我决定尝试这个项目:
http://code.google.com/p/appengine-admin/wiki/QuickStart http://code.google.com/p/appengine-admin/wiki/QuickStart
For the sake of the experiment, I took the demo guest-book shipped with app-engine. 为了实验,我带了app-engine附带的演示客座书。 The import park look like this:
进口公园看起来像这样:
import cgi
import datetime
import wsgiref.handlers
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google import appengine_admin
The db model and the admin look like this db模型和管理员看起来像这样
class Greeting(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
date = db.DateTimeProperty(auto_now_add=True)
class AdminGreeting(appengine_admin.ModelAdmin):
model = Greeting
listFields = ('author','content','date')
editFields = ('author','content','date')
appengine_admin.register(AdminGreeting)
Yet I get this exception, trying to run the site: 然而,我得到了这个例外,试图运行该网站:
File "/home/<username>/python/google_appengine/google/appengine/tools/ dev_appserver.py", line 2875, in _HandleRequest
base_env_dict=env_dict)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 387, in Dispatch
base_env_dict=base_env_dict)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 2162, in Dispatch
self._module_dict)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 2080, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1976, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "/home/<username>/python/google_appengine/demos/guestbook/guestbook.py", line 37, in <module>
appengine_admin.register(AdminGreeting)
File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 120, in register
modelAdminInstance = modelAdminClass()
File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 64, in __init__
self._extractProperties(self.listFields, self._listProperties)
File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 76, in _extractProperties
storage.append(PropertyWrapper(getattr(self.model, propertyName), propertyName))
File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 17, in __init__
logging.info("Caching info about property '%s'" % name)
File "/usr/lib/python2.6/logging/__init__.py", line 1451, in info
root.info(*((msg,)+args), **kwargs)
File "/usr/lib/python2.6/logging/__init__.py", line 1030, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python2.6/logging/__init__.py", line 1142, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
File "/usr/lib/python2.6/logging/__init__.py", line 1117, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
File "/usr/lib/python2.6/logging/__init__.py", line 272, in __init__
from multiprocessing import current_process
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
return func(self, *args, **kwargs)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1736, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
return func(self, *args, **kwargs)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1638, in FindAndLoadModule
description)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
return func(self, *args, **kwargs)
File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1589, in LoadModuleRestricted
description)
File "/usr/lib/python2.6/multiprocessing/__init__.py", line 83, in <module>
import _multiprocessing
ImportError: No module named _multiprocessing
INFO 2009-04-25 23:34:27,628 dev_appserver.py:2934] "GET / HTTP/1.1" 500 -
Any idea what could have went wrong? 什么可能出错?
您似乎使用的是Python 2.6(假设某些消息来自/usr/lib/python2.6 ......中的文件),但Google App Engine需要Python 2.5(任何2.5.x都可以用于任何版本的x),因此您应该安装并使用它来运行App Engine SDK。
Google App Engine only supports Python 2.5, and you're on a newer version. Google App Engine仅支持Python 2.5,而您使用的是较新版本。
By the look of your directories, you might be on a Linux (or is it a Mac?). 通过你的目录看,你可能在Linux上(或者它是Mac?)。 On, say, Ubuntu you can "sudo apt-get install python2.5" (it won't affect your Python 2.6 at all), and then rather than:
比方说,Ubuntu你可以“sudo apt-get install python2.5”(它根本不会影响你的Python 2.6),而不是:
<path-to-gae>/dev_appserver.py ...
do 做
python2.5 <path-to-gae>/dev_appserver.py ...
This is better than just blithely developing on 2.6 and deploying on 2.5 which is surely asking for hassles later on. 这比仅仅在2.6上开发并在2.5上部署更好,这肯定会在以后要求麻烦。
As others have said, this problem occurs in Python 2.6. 正如其他人所说,这个问题发生在Python 2.6中。 I used the fix proposed in this comment in the App Engine issue tracker :
我在App Engine问题跟踪器中使用了此评论中提出的修复:
A quickfix is to create a file in your app's root named `_multiprocessing.py' with
the contents:
import multiprocessing
This way it's possible to import the _multiprocessing module.
It worked for me using Python 2.6.2
Cheers,
Kaji
To make this work on my local machine (with 2.6) and on GAE, I used: 为了在我的本地机器(使用2.6)和GAE上工作,我使用了:
import sys, logging
if sys.version[:3] == "2.6": logging.logMultiprocessing = 0
just do the following at the top of your something.py 只需在你的something.py顶部执行以下操作
import logging logging.logMultiprocessing = 0 import logging logging.logMultiprocessing = 0
import logging
logging.logMultiprocessing = 0
Worked for me 为我工作
It wired that I have been using GAE with python2.6(probably 2.6.1), and every thing worked fine. 它连接了我一直使用GAE和python2.6(可能是2.6.1),并且每件事都运行良好。
But now I get the same _multiprocess import error.(python2.6.2). 但现在我得到了相同的_multiprocess导入错误。(python2.6.2)。
import logging
logging.logMultiprocessing = 0
Worked for me too. 也为我工作。 Before uploading to GAE, comment those lines.
在上传到GAE之前,请评论这些行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.