【发布时间】:2014-05-10 06:11:05
【问题描述】:
我正在尝试使用 uWSGI + Nginx 设置应用程序网络服务器,它运行使用 SQLAlchemy 与 Postgres 数据库通信的 Flask 应用程序。
当我向网络服务器发出请求时,其他所有响应都会出现 500 错误。
错误是:
Traceback (most recent call last):
File "/var/env/argos/lib/python3.3/site-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
context)
File "/var/env/argos/lib/python3.3/site-packages/sqlalchemy/engine/default.py", line 388, in do_execute
cursor.execute(statement, parameters)
psycopg2.OperationalError: SSL error: decryption failed or bad record mac
The above exception was the direct cause of the following exception:
sqlalchemy.exc.OperationalError: (OperationalError) SSL error: decryption failed or bad record mac
错误是由一个简单的Flask-SQLAlchemy方法触发的:
result = models.Event.query.get(id)
uwsgi 由supervisor 管理,它有一个配置:
[program:my_app]
command=/usr/bin/uwsgi --ini /etc/uwsgi/apps-enabled/myapp.ini --catch-exceptions
directory=/path/to/my/app
stopsignal=QUIT
autostart=true
autorestart=true
uwsgi 的配置如下:
[uwsgi]
socket = /tmp/my_app.sock
logto = /var/log/my_app.log
plugins = python3
virtualenv = /path/to/my/venv
pythonpath = /path/to/my/app
wsgi-file = /path/to/my/app/application.py
callable = app
max-requests = 1000
chmod-socket = 666
chown-socket = www-data:www-data
master = true
processes = 2
no-orphans = true
log-date = true
uid = www-data
gid = www-data
我能得到的最远的是它与 uwsgi 的分叉有关。但除此之外,我不清楚需要做什么。
【问题讨论】:
标签: postgresql nginx sqlalchemy flask uwsgi