繁体   English   中英

django postgres无法连接到服务器:连接被拒绝服务器在主机“ localhost”上运行吗(127.0.0.1)

[英]django postgres could not connect to server: Connection refused Is the server running on host “localhost” (127.0.0.1)

我只是使用Zappaaws-lambda上部署Django应用,但出现错误。 我不知道是否必须安装Postgres,因为我认为它是从requirements.txt自动安装的

OperationalError at /admin/login/ could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

Request Method:     POST
Request URL:    https://tmzgl5al3h.execute-api.ap-south-1.amazonaws.com/dev/admin/login/?next=%2Fdev%2Fadmin%2F
Django Version:     2.1.4
Exception Type:     OperationalError
Exception Value:    could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

Exception Location:     /var/task/psycopg2/__init__.py in connect, line 130
Python Executable:  /var/lang/bin/python3.6
Python Version:     3.6.1
Python Path:        ['/var/task', '/opt/python/lib/python3.6/site-packages', '/opt/python', '/var/runtime', '/var/runtime/awslambda', '/var/lang/lib/python36.zip', '/var/lang/lib/python3.6', '/var/lang/lib/python3.6/lib-dynload', '/var/lang/lib/python3.6/site-packages', '/opt/python/lib/python3.6/site-packages', '/opt/python', '/var/task']

PostgreSQL不是python库,而是独立的开源数据库,您一定要设置它

在AWS领域中,您应该将其设置为RDS实例,并相应地配置您的环境

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM