Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用uWSGI运行时无法执行Postgres查询_Python_Postgresql_Flask_Uwsgi - Fatal编程技术网

Python 使用uWSGI运行时无法执行Postgres查询

Python 使用uWSGI运行时无法执行Postgres查询,python,postgresql,flask,uwsgi,Python,Postgresql,Flask,Uwsgi,我有一个基本的flask应用程序,其中我正在连接本地Postgres服务器 问题是,当我使用python管理器运行应用程序时,它工作正常。但当我使用uWSGI运行应用程序时,查询不会执行,也就是说,它超时而不会抛出任何错误消息 我有一个相对简单的wsgi配置文件,如 [uwsgi] module = wsgi master = true processes = 1 http = 0.0.0.0:5000 buffer-size = 32768 vacuum = true die-on-te

我有一个基本的flask应用程序,其中我正在连接本地Postgres服务器

问题是,当我使用python管理器运行应用程序时,它工作正常。但当我使用uWSGI运行应用程序时,查询不会执行,也就是说,它超时而不会抛出任何错误消息

我有一个相对简单的wsgi配置文件,如

[uwsgi]
module = wsgi

master = true
processes = 1

http = 0.0.0.0:5000
buffer-size = 32768
vacuum = true

die-on-term = true
我的flask应用程序使用
psycopg2
与本地主机连接

connection = psycopg2.connect(
        host='127.0.0.1',
        port=5432,
        database='db',
        user='user',
        password='password'
    )

我认为这可能是因为uWSGI()无法访问postgresql套接字。我相信这可以通过向uWSGI提供postgres套接字权限来解决,但我不知道如何解决。如果有其他解决方案,那么也可以。

请提供uwsgi日志?可能位于
/var/log/uwsgi
。它只显示我的应用程序日志,没有任何特定于uwsgi的错误。应用程序在
cursor.execute()
行超时。可能与postgres配置有关。你们修复了吗?Postgres连接很好,因为我可以在运行应用程序时查询,而不使用uWSGI。这似乎是关于套接字权限的问题