2012-02-10 28 views
1

我正在嘗試使用remote_api_shell.py訪問我的應用程序,如在appengine http://code.google.com/appengine/articles/remote_api.html中所述。我在Windows 7中使用python 27,並且能夠訪問shell - 例如,我已經遠程清除了memcache。我無法訪問的數據存儲與錯誤如何在Windows機器上使用remote_api_shell訪問appengine數據存儲?

no module found named <module name> 

我的目錄stucture像這樣

/app.yaml 
/main.py 
/users/models.py 

Windows Shell中我鍵入以下(按照演練在上面的鏈接)

C:\Users\user>remote_api_shell.py -s appname.appspot.com 
App Engine remote_api shell 
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] 
The db, users, urlfetch, and memcache modules are imported. 
s~appname> import appname 
Traceback (most recent call last): 
File "<console>", line 1, in <module> 
ImportError: No module named appname 
s~appname> from google.appengine.ext import db 
s~appname> from users.models import * 
Traceback (most recent call last): 
File "<console>", line 1, in <module> 
ImportError: No module named users.models 
s~appname> from users import models 
Traceback (most recent call last): 
File "<console>", line 1, in <module> 
ImportError: No module named users 

我已經嘗試了幾次不同的迭代,但似乎無法訪問我的任何數據。我也嘗試訪問目錄/website/models.py中的另一個模型,但也沒有成功。任何想法如何讓這個工作?乾杯。

回答

3

嘗試設置模塊搜索路徑以包含應用程序所在的目錄。這可以通過設置環境變量PYTHONPATH來完成(儘管我忘記了如何在Windows上執行此操作),或者在shell會話中,通過追加到sys.path來完成。

的原因是remote_api_shell腳本住在不同的目錄你的應用程序,所以目錄被添加到路徑,而不是應用程序的目錄,即使後者是當前目錄。

我猜你也可以remote_api_shell.py複製到您的應用程序目錄...

0

很明顯,你可以複製到models.py目錄remote_api_shell.py{:^)

相關問題