首页 > 解决方案 > PostgreSQL 通过 django 而不是 wsgi 连接,库没有密码

问题描述

我正在尝试在我的 django 应用程序中连接到另一台服务器上的数据库,但出现错误(在我的 apache 错误日志中):

django.db.utils.OperationalError:无法创建 SSL 上下文:库没有密码

我可以使用 manage.py shell 并连接到这个数据库:

>>> import psycopg2
>>> conn = psycopg2.connect("dbname=mobilesurvey user=django password=xxx host=dugong-api-rmove.rsginc.com port=5432")

我能做些什么来通过 django 完成这个工作?

标签: djangoapache2mod-wsgipsycopg2

解决方案


这个问题线程有许多解决方法,但对我有用的是从源代码构建 psycopg2(做一个pip install -r requirements.txt,我的 requirements.txt 文件包括:) psycopg2==2.7.4 --no-binary :all:


推荐阅读