这个社区是我解决这个问题的最后手段,因为我已经为此奋斗了几个小时:(。
我在一个项目上工作,我尝试使用 docker-compose 进行测试,使用这个命令,docker-compose run runserver python3.6 manage.py test但是,我不明白它来自哪里以及如何解决这个问题。这是我的错误
/usr/local/lib/python3.6/dist-packages/django/db/backends/postgresql/base.py:267: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the default database instead.
和
psycopg2.OperationalError: could not connect to server: Connection timed out Is the server running on host "postgres" (172.18.0.3) and accepting TCP/IP …