Python 在heroku上插入postgres执行,但不执行';我不能留下来
我与以下方面有联系:Python 在heroku上插入postgres执行,但不执行';我不能留下来,python,postgresql,heroku,psycopg2,Python,Postgresql,Heroku,Psycopg2,我与以下方面有联系: url = urlparse.urlparse(os.environ["DATABASE_URL"]) self.conn = psycopg2.connect( database=url.path[1:], user=url.username, password=url.password, host=url.hostname, port=url.port
url = urlparse.urlparse(os.environ["DATABASE_URL"])
self.conn = psycopg2.connect(
database=url.path[1:],
user=url.username,
password=url.password,
host=url.hostname,
port=url.port
)
当我运行查询以插入self.cursor.execute(“插入到Divers(email,hashpass)值(%s,%s);”,[email,password])
时,它会成功返回
但是,当我检查我的数据时,注册不存在。当我通过CLI运行此查询时,它会插入,但增加的id会增加,就像插入了值一样。请提供帮助。文档显示了一个
commit()
方法。因此,您可能希望尝试这样使用它:
self.conn.commit()
您不需要
self.cursos.commit()
或类似的东西吗?谢谢,在您发表评论之前就解决了这个问题!