无法将数据上载到本地数据

2024-06-02 06:59:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用下面的命令上传到本地数据存储,但它不断提示进行身份验证,并且在我给出我的个人数据存储时失败。我还没有在服务器上创建一个应用程序,只是在本地创建了一个并进行了测试。我能够创建一个数据存储和读写数据到它,我试图上传到它的实际数据,并编写了一个加载器脚本。但是它没有按预期工作

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

我的型号.py是

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()

加载程序脚本是

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]
`

Tags: 数据frompyimport脚本dbaddressemail