django - 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 完成这个工作?
解决方案
这个问题线程有许多解决方法,但对我有用的是从源代码构建 psycopg2(做一个pip install -r requirements.txt
,我的 requirements.txt 文件包括:) psycopg2==2.7.4 --no-binary :all:
。
推荐阅读
- java - 在 Java Spring 框架中使用 Rest 控制器反序列化接口
- vue.js - Vue.js 对替换的数组元素没有反应
- reactjs - React semantic-ui-date-picker 默认日期不起作用
- javascript - 如何在不重复的情况下在过滤器按钮内插入内容
- arduino - 如何使用 GPS 数据和 Arduino Mega 获取日出/日落时间
- azure - 如果 kusto 中没有结果,则返回 null 而不是什么都没有
- pandas - 如何将我的数据框中的列存储在 numpy 数组中?
- php - 将购买特定产品的客户从单个产品页面重定向
- python - TOOLTIPS / 悬停在 Bokeh / Python 问题
- sql-server - Windows 函数从 EF.NET Core 调用时更改值