what is the '<app-directory>' of remote_api in google-app-engine
http://code.google.com/intl/en/appengine/docs/python/tools/uploadingdata.html
the api is :
Downloading Data from App Engine
To start a data download, run appcfg.py download_data with the appropriate arguments:
appcfg.py download_data --config_file=album_loader.py --filename=album_data_archive.csv --kind=Album <app-directory>
i want to download data from my gae app zjm1126.appspot.com
so i write this in the commond:
appcfg.py download_data --config_file=GreetingLoad.py --filename=GreetingLoad.csv
开发者_Go百科
but, i don't know how to write the 'app-directory'
so , how to write the 'app-directory'..
thanks
updated
i use this:
appcfg.py download_data --config_file=helloworld/GreetingLoad.py --filename=a.csv --kind=Greeting helloworld
and the error is :
D:\zjm_code>appcfg.py download_data --config_file=helloworld/GreetingLoad.py --f
ilename=a.csv --kind=Greeting helloworld
Application: zjm1126; version: 1-h1.
Downloading data records.
[INFO ] Logging to bulkloader-log-20100518.195933
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
[INFO ] Opening database: bulkloader-progress-20100518.195933.sql3
Traceback (most recent call last):
File "d:\Program Files\Google\google_appengine\appcfg.py", line 68, in <module
>
run_file(__file__, globals())
File "d:\Program Files\Google\google_appengine\appcfg.py", line 64, in run_fil
e
execfile(script_path, globals_)
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2709, in <module>
main(sys.argv)
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2700, in main
result = AppCfgApp(argv).Run()
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 1763, in Run
self.action(self)
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2580, in __call__
return method()
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2446, in PerformDownload
run_fn(args)
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2368, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "D:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 4012, in Run
return _PerformBulkload(arg_dict)
File "D:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 3887, in _PerformBulkload
exporter = Exporter.RegisteredExporter(kind)
File "D:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 2901, in RegisteredExporter
return Exporter.__exporters[kind]
KeyError: 'Greeting'
and my GreetingLoad.py is :
import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
class Greeting(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
date = db.DateTimeProperty(auto_now_add=True)
class GreetingLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Greeting',
[('author', lambda x: x.decode('utf-8')),
('content', lambda x: x.decode('utf-8')),
('date',
lambda x: datetime.datetime.strptime(x, '%m/%d/%Y').date())
])
loaders = [GreetingLoader]
mu url is :
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
updated2
it is ok now ,thanks
appcfg.py download_data --config_file=helloworld/GreetingLoad.py --filename=a.csv --kind=Greeting helloworld
and
class AlbumExporter(bulkloader.Exporter):
def __init__(self):
bulkloader.Exporter.__init__(self, 'Greeting',
[('author', str, None),
('content', str, None),
('date', str, None),
])
exporters = [AlbumExporter]
Please take a look at this article, it explains how to set up downloading data: http://code.google.com/appengine/docs/python/tools/uploadingdata.html
The app-directory
is the path you set up in the app.yaml
file to map to the remote_api:
- url: /app-directory
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
To answer the updated question:
change your loaders = ...
line to exporters = [GreetingExporter]
精彩评论