1

I just deploy Django app on aws-lambda with Zappa but I am getting an error. I don't know if I have to install Postgres because I think its automatically installed from 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']
4

1 回答 1

1

PostgreSQL不是 python 库,而是一个独立的开源数据库,你绝对应该设置它

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

于 2019-01-07T17:28:32.780 回答