我正在使用django-cookiecutter模板,并且第二次用于新项目。并且它无法连接到 postgres,并出现以下错误:
postgres_1 | 2018-04-30 14:54:09.747 UTC [1] LOG: database system is ready to accept connections
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] FATAL: password authentication failed for user "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX"
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] DETAIL: Role "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX" does not exist.
postgres_1 | Connection matched pg_hba.conf line 95: "host all all all md5"
django_1 | PostgreSQL is unavailable (sleeping)...
其中一位维护者解释说:
the thing is, every time you bootstrap the project POSTGRES_USER and POSTGRES_PASSWORD get reset to a newly-generated random values
我试图删除所有 docker 容器但没有成功,不知道我该如何解决这个问题?我没有旧的凭据来替换它们。
在 https://github.com/webyneter 的帮助下(django-cookiecutter 的贡献者(
解决方案如下:
- 要查看现有卷:
docker volume ls
- 删除相应的卷
docker volume rm <your project_slug>_postgres_backup_local <your project_slug>_postgres_data_local