can i upload gae-data to localhost server
this is my Teackback:
D:\zjm_demo\app>appcfg.py upload_data --config_file=upload/str_loader.py --filename=upload/a.csv --kind=College --url=http://localhost:8100/remote_api
Uploading data records.
app_id argument required for non appspot.com domains
D:\zjm_demo\app>appcfg.py upload_data --app_id=zjm1126 --config_file=upload/str_loader.py --filename=upload/a.csv --kind=College --url=http://localhost:8100/rem
ote_api
Usage: appcfg.py [options] <action>
appcfg.py: error: no such option: --app_id
D:\zjm_demo\app>appcfg.py upload_data app_id=zjm1126 --config_file=upload/str_loader.py --filename=upload/a.csv --kind=College --url=http://localhost:8100/remot
e_api
Usage: appcfg.py [options] upload_data <directory>
appcfg.py: error: Not a directory: app_id=zjm1126
can i upload data to localhost server .
thanks
updated
my ste_loader.开发者_运维知识库py is :
from google.appengine.ext import db
from google.appengine.tools import bulkloader
# 以下是 Model 的 Definition
class College(db.Model):
cid = db.StringProperty(required=True)
name = db.StringProperty(required=True)
# 以下是匯入資料的 class
class CollegeLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'College',
[
('cid', str),
('name', lambda x: unicode(x, 'utf-8')),
])
loaders = [CollegeLoader]
The argument for upload_data is --application or -A, not --app_id:
upload_data --application=zjm1126 --config_file=upload/str_loader.py --filename=upload/a.csv --kind=College --url=http://localhost:8100/rem
I realise this is an old question, but I'm trying to do this myself and thought I should leave a note for future travellers.
Yes: You can upload data to the dev server running on local host. The ste_loader.py file in the original question is a deprecated way of doing this. The preferred way is to write a .yaml file to describe the transforms. I found useful information to help me understand that here, and here (but be careful I think this is outdated). The official docs are here: GAE Documentation for appcfg.py and bulkloader.yaml, but unfortunately I didn't find it very helpful. I eventually resorted to reading the source here: source for google.appengine.ext.bulkload.transform.py.
appcfg.py download_data --url=http://APPNAME.appspot.com/_ah/remote_api --filename=dump --kind=EntityName
appcfg.py upload_data --url=http://127.0.0.1:8080/_ah/remote_api --filename=dump --application=dev~APPNAME
If you have problems with the authentication, put the following in your appengine_config.py:
if os.environ.get('SERVER_SOFTWARE','').startswith('Development'):
remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
'REMOTE_ADDR', ['127.0.0.1'])
精彩评论