谷歌App Engine和上传脚本 [英] Google App Engine and Upload script
问题描述
我目前使用了Android开发包来Eclipse和下面的教程GAE:
I'm currently using Eclipse that came with Android Development bundle and following the GAE tutorial:
<一个href=\"https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial\" rel=\"nofollow\">https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial
我从来没有任何服务器或后端的经历,我希望能够让使用App Engine的功能的Android应用程序。
I never had any server or backend experiences and I am hoping to make a Android application using features of the App Engine.
似乎一切都进展顺利以下教程,直到我到哪里,你需要创建上传脚本的部分。我不知道我应该怎么着手我读到它越越糊涂的我。
Everything seems to be going smoothly following the tutorial until I got to the part where you need to "Create an upload script". I have no idea how I should proceed the more I read into it the more confused I am.
本教程说,创建一个目录,并使其成为当前目录,然后创建一个脚本文件,但我想我做出新的目录,并把它在Eclipse的AppEngine项目在Package Explorer或别的地方?我真的不知道怎么做所有这些工作在一起。
The tutorial said to "Create a directory and make it your current directory" then create a script file but am I suppose to make the new directory and put it in Eclipse's AppEngine project in the package explorer or somewhere else? I don't really know how does all of this work together.
我刚刚安装Eclipse的蟒蛇2.7并确保该跨的PyDev preTER指向python.exe但除此之外,我真的不知道从哪里点下去了。
I just got python 2.7 installed for Eclipse and made sure that the PyDev interpreter is pointing to python.exe but besides that I don't really know where to go from that point on.
EDIT1:我使用Cygwin和运行SH upload_data.shPlace。当我运行它,我得到以下错误:
I am using Cygwin and run "sh upload_data.shPlace". And when I run it I get the following error:
C:\Python27\python.exe: can't open file '/cygdrive/c/Program Files (x86)/Google/google_appengine/appcfg.py': [Errno 2] No such file or directory
我尝试添加C:\\ Program Files文件(x86)的\\谷歌\\ google_appengine \\ appcfg.py到upload.sh文件。它看起来像下面这样:
I tried adding "C:\Program Files (x86)\Google\google_appengine\appcfg.py" to the upload.sh file. It looked like the following:
C:\Program Files (x86)\Google\google_appengine\appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename $1 --kind=$2 -e myemail@mail.com
出现以下错误:
upload_data.sh: line 2: syntax error near unexpected token `('
upload_data.sh: line 2: `/cygdrive/c/Program Files (x86)/Google/google_appengine\appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename $1 --kind=$2 -e mymail@mail.com'
EDIT2:好的,我的(和使用\\的空间,以及前加上'\\'来下面是upload.sh code现在
Ok I added '\' to before the '(' and used '\' for spaces as well. The following is code in upload.sh right now.
C:\Program\Files\(x86\)\Google\google_appengine\appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename $1 --kind=$2 -e mymail@mail.com
然后,它想出了以下错误以下错误:
Then the following error it came up with the following error:
upload_data.sh: line 2: C:ProgramFiles(x86)Googlegoogle_appengineappcfg.py: command not found
我去了谷歌应用程序引擎目录和appcfg.py是存在的。此外,我如果我确实使用了正确的命令,也不太清楚。我用:
I went to the google app engine directory and the appcfg.py is there. Additionally I am not too sure if I am actually using the right command. I used:
SH upload.data.sh(箭头支架)places.csv(箭头支架)地点
sh upload.data.sh (arrow bracket)places.csv(arrow bracket)Place
是否需要被放置在特定目录中的脚本或什么?我试过把appcfg.py文件在我的scripts目录中,我只保留说upload_data.sh文件[错误2]没有这样的文件或目录。然后我试图把文件,upload.data,places.csv和bulkloader.yaml到哪里appcfg.py存储那么它会返回错误权限被拒绝谷歌/ google_appengine目录。我也重新安装python27为google_appengine文件。我试着只是运行在Cygwinappcfg.py和刚刚回归[ERR2]没有这样的文件或目录。
Does the scripts or anything needs to be placed in certain directory? I've tried putting the appcfg.py file in my scripts directory where I keep the upload_data.sh file just said [Errno 2] no such file or directory. Then I tried put the files, upload.data, places.csv and bulkloader.yaml into Google/google_appengine directory where appcfg.py is stored then it will return a "Permission Denied" error. I also re-installed python27 into "google_appengine" file. I tried just running "appcfg.py" on Cygwin and just return [Err2] No such file or directory.
然后我试图运行在Windows上运行在命令提示符写:
Then I tried running running on Windows command prompt writing in:
appcfg.py upload_data --config_file
C:\Users\User\Documents\AndroidApps\Scripts\bulkloader.yaml--url=http://localhost:8888/remote_api --filename $1 --kind=$2 -e mymail@mail.com
以下错误获取返回:
The following error gets returned:
11:09 PM Uploading data records.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 126, in
<module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 122, in
run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4934, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4925, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2648, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4605, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4417, in PerformUpload
run_fn(args)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4298, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4406, in Run
SetupLogging(arg_dict)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4362, in SetupLogging
file_handler = logging.FileHandler(log_file, 'w')
File "C:\Program Files (x86)\Google\google_appengine\lib\logging\__init__.py",
line 889, in __init__
StreamHandler.__init__(self, self._open())
File "C:\Program Files (x86)\Google\google_appengine\lib\logging\__init__.py",
line 908, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Google\\google_
appengine\\bulkloader-log-20140314.230944'
好像我不能在Cygwin中使用appcfg.py的。我已经卡住现在几乎2天。
It seems like I can't use appcfg.py in Cygwin at all. I've been stuck for almost 2 days now.
感谢。
推荐答案
遇到同样的问题。结果
本教程是不是写得很好在这个特别的一点。
我做了一个Ubuntu系统上的以下
Ran into the same problem.
The tutorial is not very well written at this particular point.
I did the following on an Ubuntu system
- 下载google_appengine为Python https://developers.google.com/appengine/downloads
- 某处提取文件夹
- 从MobileAssistant-数据places.csv和bulkloader.yaml复制到文件夹
- 该文件夹中创建文件upload_data.sh文件
-
写下面两行并保存文件
- Download google_appengine for Python https://developers.google.com/appengine/downloads
- Extract the folder somewhere
- Copy the places.csv and bulkloader.yaml from MobileAssistant-Data to the folder
- Create the file upload_data.sh file in that folder
Write the following two lines and save the file
#!/bin/sh
./appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename $1 --kind=$2 -e nobody@nowhere.com
请文件的可执行 CHMOD一个+ X upload_data.sh
如果一切顺利wen't运行:
If all wen't well, running:
<google_appengine folder>./upload_data.sh places.csv Place
应该输出是这样的:
Should output something like:
12:55 PM Uploading data records.
[INFO ] Logging to bulkloader-log-20140918.125544
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
Password for nobody@nowhere.com:
[INFO ] Opening database: bulkloader-progress-20140918.125544.sql3
[INFO ] Connecting to localhost:8888/remote_api
[INFO ] Starting import; maximum 10 entities per post
.
[INFO ] 2 entities total, 0 previously transferred
[INFO ] 2 entities (1696 bytes) transferred in 58.8 seconds
[INFO ] All entities successfully transferred
希望它帮助!
这篇关于谷歌App Engine和上传脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!