Which credentials should I put in for Google App Engine BulkLoader at development server?

后端 未结 9 1948
[愿得一人]
[愿得一人] 2021-02-10 06:28

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_         


        
9条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-10 06:38

    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.

提交回复
热议问题