擅长:python、mysql、java
<p>检查您的Postgres服务是否传递了环境变量:</p>
<pre><code>version: "3"
services:
django:
build: .
restart: on-failure
container_name: django
command: bash -rc "python intento/manage.py makemigrations &&
python intento/manage.py migrate &&
gunicorn limit-request-line 8190 workers=3
chdir /usr/src/app/src wsgi:application bind 0.0.0.0:8000"
volumes:
- .:/usr/src/app
expose:
- 8000
env_file:
- ./.env
depends_on:
- pgdb
pgdb:
image: postgres
restart: on-failure
container_name: pgdb
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
</code></pre>
<p>编辑:刚刚看到您给出的示例,使用以下内容更改Postgres环境属性中的=:</p>