我使用remote_api连接到我的应用程序。当我尝试使用下面的代码导入模型时
from models import SimpleCounterShard我得到以下错误
ImportError: No module named models我试图寻找解决方案,但似乎与PYTHONPATH有关。有人能告诉我怎么解决这个问题吗?我使用的是Mac电脑。
发布于 2011-03-09 13:08:33
我将应用程序目录添加到我的系统路径中,它起作用了
发布于 2011-03-08 22:18:18
通过连接到remote_api,您可以访问生产数据,但不能访问python模块。您的源代码必须在本地计算机上可用,才能实现您想要做的事情。
发布于 2014-09-04 02:12:59
这里有一个OSX的解决方案。我只需附加来自AppEngine Python SDK的Python库。确保你的app.yaml包含这个神奇的句子。
builtins:
- remote_api: on
import sys
import glob
sys.path.append('/usr/local/google_appengine')
for l in glob.glob("/usr/local/google_appengine/lib/*"):
sys.path.append(l)
import getpass
from google.appengine.ext.remote_api import remote_api_stub
# import your app-specific libraries here.
def auth_func():
return (raw_input('Username:'), getpass.getpass('Password:'))
# or hardcode it; remember you MUST use application passwords.
# https://security.google.com/settings/security/apppasswords
# return ('USERNAME', 'PASSWORD')
remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func,
'______.appspot.com')
# do your stuff here.https://stackoverflow.com/questions/5232892
复制相似问题