I would like to ask which kind of credentials do I need to put on for importing data using the Google App Engine BulkLoader class
appcfg.py upload_data --config_
EUREKA: I found the way to use the bulkloader.py
tool without having to manually enter login credentials.
Here are the 2 steps:
Set your app.yaml
file up. Example:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
You should put it BEFORE your - url: .*
line in app.yaml
, otherwise you will never access the /remote_api
url.
Note that I've left the login: admin
part, as removing it is a VERY BAD practice, since you might deploy that into production...
2 Launch this command (adapt it to your needs).
echo 'XX' | python2.5 ../google_appengine/bulkloader.py --dump --kind=NAMEOFMODEL --url=http://localhost:8080/remote_api --filename=FILENAME --app_id=APPID --email=foobar@nowhere.com --passin .
The trick is to use the combination of those 2 parameters:
--email=
(you can put whichever email address you want, I use foobar@nowhere.com
)--passin
Specifying --email=
will suppress the "enter credentials" prompt, and --passin
will allow to read the password from stdin
(that's where the echo 'XX' |
comes into play!)
Enjoy!
P.S.: Don't forget to vote so that Google can provide an easier to use way to do that: Issue 2440.
Yes, comment out the admin requirement for the remote_api:
[app.yaml]
- url: /remote_api script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py # login: admin
Then run this command:
$ bulkloader.py --dump --kind=DbMyKind --url=http://localhost:8080/remote_api --filename=export.csv --app_id=my_appid --auth_domain=localhost:8080
Note: verify that --auth_domain is passed, and proper port is passed for localhost.
Next worked for me:
removing the line
login:admin
from app.yaml
Updating app cofig:
appcfg.py update [app-id]
(Re)starting local server:
appserver [app-id]
Upload data:
appcfg.py upload_data --config_file=album_loader.py --filename album_data.csv --kind Album --url=http://localhost:8080/remote_api ../[app-id]
Ask for mail and password type anything
Use aaa@gmail.com
for username.
Use a
for password.
It works. Magically.
Edit: Look at my new solution
This problem is still present. I have opened a ticket to ask if the authentication could be bypassed on the local dev server. Please vote for this issue so that we can have it resolved [quickly].
I have been able to upload data to the dev server by:
Leaving the "login:admin" line is a good thing, as you will not upload your app on the production servers without this line, which could expose you to someone adding data to your datastore...
Blockquote
I use this commands to transfer data from local to remote server. File's extension (json) is important. Framework: django-nonrel, os: Win7.
manage.py dumpdata >dump.json
manage.py remote loaddata dump.json