相关疑难解决方法(0)

无法在Django上运行服务器(连接被拒绝)

我终于(想)成功安装了PostgreSQL和de psycopg2(我用的是Windows).顺便说一句,是否有一些方法可以检查它是否正常工作?

嗯,现在的想法是我无法启动服务器,而我键入'python manage.py runserver'它出现了这个(在命令的末尾):

conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 8000?
could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 8000?
Run Code Online (Sandbox Code Playgroud)

我已经搜索了很多关于它的文档,例如在本主题中,但我找不到让它正常工作的方法.我在pg_hba和postgresql文件中尝试了几处更改,但没有退出.在这一刻,pg_hba看起来像:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# IPv4 local connections:
host    all             all             127.0.0.1            md5
# IPv6 local connections:
host …
Run Code Online (Sandbox Code Playgroud)

python django postgresql

13
推荐指数
5
解决办法
3万
查看次数

标签 统计

django ×1

postgresql ×1

python ×1