我已经用postgres数据库创建了django项目,我已经将我的项目部署到heroku服务器中,并且还使用
heroku run python manage.py migrate
我想将存储的数据库推送到heroku数据库
PGUSER=edpuser PASSWORD=1qazxsw2 heroku pg:push applications postgresql-curly-07168 --app application
但是
> error shiv@shiv:~/Documents/projects/django_related_project/zoedp$
> heroku pg:push applications postgresql-curly-07168 --app application
> heroku-cli: Pushing applications ---> postgresql-curly-07168 ▸
> Remote database is not empty. Please create a new database or use
> heroku pg:reset
我还运行命令heroku pg:reset并重试 这次我犯了个错误
shiv@shiv:~/Documents/projects/django_related_project/zoedp$ PGUSER=edpuser PASSWORD=1qazxsw2 heroku pg:push applications postgresql-curly-07168 --app application
heroku-cli: Pushing edpapplication ---> postgresql-curly-07168
pg_dump: [archiver (db)] connection to database "application" failed: FATAL: Peer authentication failed for user "edpuser"
pg_restore: [custom archiver] could not read from input file: end of file
▸ pg_dump errored with 1
这是我的设置。py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'applications',
'USER': 'edpuser',
'PASSWORD': '1qazxsw2',
'HOST': 'localhost',
'PORT': '5432',
'ATOMIC_REQUESTS': True
}
}
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES['default'].update(db_from_env)
覆盖pg_hba.conf拒绝我。 我该怎么办
我遇到了这个问题,它与postgresql auth配置有关,而与herokupg:push命令无关
我建议采取这种做法:
为postgres用户设置密码: 基于这个惊人的答案:https://stackoverflow.com/a/26735105/3172310
此时此刻: 您已经为postgres用户设置了密码,并将postgres配置为在使用psql时请求id,这似乎是pg命令所做的
然后按如下方式运行命令:
替换:
而且应该很好
相关问题 更多 >
编程相关推荐