3

I needed to test some changes on my local dev server before pushing to production. Doing so required having the full dataset on my local machine.

A colleague directed me to:

https://developers.google.com/appengine/docs/python/tools/uploadingdata?csw=1

I downloaded the data using an administrator's username and password, but unfortunately, I was unable to upload the data to my localhost "dev" app engine server.

Ran this command from the commandline:

appcfg.py upload_data --filename=../data/data1.dat --url=http://localhost:9080/_ah/remote_api ./

Where:

  • 9080 was my app port on my localhost copy of the app
  • I was running this command from my app directory
  • Had the downloaded data stored in relative directory ../data/data1.dat

Received this error:

raise _ToDatastoreError(err)
google.appengine.api.datastore_errors.BadRequestError: app "dev~appname" cannot access app "appname"'s data
zeusstl
  • 1,673
  • 18
  • 19
  • @DavidBennett Sadly, I was told by my colleagues that I should not use --application along with --url. I just tried it and it does seem to work. Thanks! – zeusstl Jan 23 '14 at 22:49

1 Answers1

2

UPDATE: It seems that the answer was as simple as adding the following to my upload_data call:

--application="dev~appname"

Thanks @DavidBennett.

ORIGINAL ANSWER: (which also works)

After a ton of searching on SO and code.google.com, the solution I found that worked was a comment on this question:

devappserver2, remote_api, and --default_partition

I used my original command as described in the question:

appcfg.py upload_data --filename=../data/data1.dat --url=http://localhost:9080/_ah/remote_api ./

The username and password I entered when prompted were my apps username (in my case, my email) and the corresponding password. (If that doesn't work you might want to try blank or test@example.com based on other comments I've read, but have not tested that theory.)

I also restarted my app engine with the following flag: (don’t forget to remove the flag the next time you restart the server) (You might want to try without using this flag, since I can’t confirm that it affects anything - I’m including it here, since it was a setting that I used.)

--clear_datastore=yes

The commenter recommends to delete “dev~” in your local server code on line 84 in this file:

google/appengine/tools/devappserver2/application_configuration.py, line 84

Where:

  • that base directory 'google' is located inside of:

    /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/

  • assuming your GoogleAppEngineLauncher.app directory is in your Applications directory on your Mac

IMPORTANT: Restart your local app engine server for the changes to take effect.

Community
  • 1
  • 1
zeusstl
  • 1,673
  • 18
  • 19