velapanur
velapanur

Reputation: 335

Unable to upload data to local datastore

I am using the following command to upload to the local datastore, but It keeps prompting for authentication and It fails when i give my personal one. I havent created an App in the server yet, just created one locally and testing it. I am able to create a datastore and read and write data into it, I was trying to upload the actual data into it and wrote a loader script.but it isnt working as expected

appcfg.py upload_data --config_file=loader.py --filename=Book1.csv --kind=Contact --url=http://localhost:8080/_ah/remote_api .

my models.py is

from google.appengine.ext import db
class Contact(db.Model):
    phone_no = db.StringProperty()
    name = db.StringProperty()
    address = db.StringProperty()
    address_2 = db.StringProperty()
    city = db.StringProperty()
    state = db.StringProperty()
    zipcode = db.StringProperty()
    email_1 = db.StringProperty()
    email_2 = db.StringProperty()

and loader script is

import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import models

class ContactLoader(bulkloader.Loader):
    def __init__(self):
        bulkloader.Loader.__init__(self, 'Contact',
                                   [('phone_no', str),
                                    ('name', str),
                                    ('address',str),
                                    ('address_2', int),
                                    ('city', str),
                                    ('state',str),
                                    ('zipcode', str),
                                    ('email_1',str),
                                    ('email_2', str)
                                   ])

loaders = [ContactLoader]
`

Upvotes: 0

Views: 131

Answers (1)

Will
Will

Reputation: 207

There's been lots of solutions to this question. But I've found that the easiest solution is to run the dev server from another command line window, (or PyCharm, if you have that), then run the command again from the other window.

Upvotes: 1

Related Questions