Django cookiecutter docker 构建失败:超出最大递归深度
Django cookiecutter docker build failing: maximum recursion depth exceeded
我一直在使用 cookiecutter docker 设置进行本地开发,效果非常好。我现在已准备好构建和部署我的应用程序的生产版本。
这一切看起来都很简单,但是当我 运行 构建命令时:
$ docker-compose -f production.yml build
我得到一个运行时错误:超过最大递归深度
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 121, in perform_command
File "compose/cli/command.py", line 40, in project_from_options
File "compose/cli/command.py", line 110, in get_project
File "compose/config/config.py", line 377, in load
File "compose/config/config.py", line 508, in process_config_file
File "compose/config/config.py", line 499, in
interpolate_config_section
File "compose/config/interpolation.py", line 44, in
interpolate_environment_variables
File "compose/config/interpolation.py", line 44, in <genexpr>
File "compose/config/interpolation.py", line 39, in process_item
File "compose/config/interpolation.py", line 39, in <genexpr>
File "compose/config/interpolation.py", line 54, in interpolate_value
...
...
RuntimeError: maximum recursion depth exceeded
Failed to execute script docker-compose
我不知道是什么原因造成的。我的本地设置和生产设置之间的主要区别是 production.yml 和 .django env 设置。见下文。想法?谢谢!
production.yml
version: '2'
volumes:
postgres_data: {}
postgres_backup: {}
caddy: {}
services: &django
django:
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
command: /gunicorn.sh
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
volumes:
- postgres_data:/var/lib/postgresql/data
- postgres_backup:/backups
env_file:
- ./.envs/.production/.postgres
caddy:
build:
context: .
dockerfile: ./compose/production/caddy/Dockerfile
depends_on:
- django
volumes:
- caddy:/root/.caddy
env_file:
- ./.envs/.production/.caddy
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
redis:
image: redis:3.0
celeryworker:
<<: *django
depends_on:
- redis
- postgres
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
ports: []
command: /start-celeryworker.sh
celerybeat:
<<: *django
depends_on:
- redis
- postgres
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
ports: []
command: /start-celerybeat.sh
.django
# General
# ------------------------------------------------------------------------------
# DJANGO_READ_DOT_ENV_FILE=True
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=auto generated long key
DJANGO_ADMIN_URL=auto generated admin url
DJANGO_ALLOWED_HOSTS=my deploy ip
# Security
# ------------------------------------------------------------------------------
# TIP: better off using DNS, however, redirect is OK too
DJANGO_SECURE_SSL_REDIRECT=False
# Email
# ------------------------------------------------------------------------------
MAILGUN_API_KEY=
DJANGO_SERVER_EMAIL=
MAILGUN_DOMAIN=
# AWS
# ------------------------------------------------------------------------------
DJANGO_AWS_ACCESS_KEY_ID=
DJANGO_AWS_SECRET_ACCESS_KEY=
DJANGO_AWS_STORAGE_BUCKET_NAME=
# django-allauth
# ------------------------------------------------------------------------------
DJANGO_ACCOUNT_ALLOW_REGISTRATION=True
# Gunicorn
# ------------------------------------------------------------------------------
WEB_CONCURRENCY=4
# Sentry
# ------------------------------------------------------------------------------
DJANGO_SENTRY_DSN=
看起来你 运行 变成了 an old bug。
您的 auto-generated 长字符串是否以 $
开头?如果是这种情况,它会导致 django-environ 尝试插入值并崩溃。尝试 re-generating 这些,应该可以解决问题。
我一直在使用 cookiecutter docker 设置进行本地开发,效果非常好。我现在已准备好构建和部署我的应用程序的生产版本。
这一切看起来都很简单,但是当我 运行 构建命令时:
$ docker-compose -f production.yml build
我得到一个运行时错误:超过最大递归深度
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 121, in perform_command
File "compose/cli/command.py", line 40, in project_from_options
File "compose/cli/command.py", line 110, in get_project
File "compose/config/config.py", line 377, in load
File "compose/config/config.py", line 508, in process_config_file
File "compose/config/config.py", line 499, in
interpolate_config_section
File "compose/config/interpolation.py", line 44, in
interpolate_environment_variables
File "compose/config/interpolation.py", line 44, in <genexpr>
File "compose/config/interpolation.py", line 39, in process_item
File "compose/config/interpolation.py", line 39, in <genexpr>
File "compose/config/interpolation.py", line 54, in interpolate_value
...
...
RuntimeError: maximum recursion depth exceeded
Failed to execute script docker-compose
我不知道是什么原因造成的。我的本地设置和生产设置之间的主要区别是 production.yml 和 .django env 设置。见下文。想法?谢谢!
production.yml
version: '2'
volumes:
postgres_data: {}
postgres_backup: {}
caddy: {}
services: &django
django:
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
command: /gunicorn.sh
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
volumes:
- postgres_data:/var/lib/postgresql/data
- postgres_backup:/backups
env_file:
- ./.envs/.production/.postgres
caddy:
build:
context: .
dockerfile: ./compose/production/caddy/Dockerfile
depends_on:
- django
volumes:
- caddy:/root/.caddy
env_file:
- ./.envs/.production/.caddy
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
redis:
image: redis:3.0
celeryworker:
<<: *django
depends_on:
- redis
- postgres
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
ports: []
command: /start-celeryworker.sh
celerybeat:
<<: *django
depends_on:
- redis
- postgres
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
- ./.envs/.production/.celery
ports: []
command: /start-celerybeat.sh
.django
# General
# ------------------------------------------------------------------------------
# DJANGO_READ_DOT_ENV_FILE=True
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=auto generated long key
DJANGO_ADMIN_URL=auto generated admin url
DJANGO_ALLOWED_HOSTS=my deploy ip
# Security
# ------------------------------------------------------------------------------
# TIP: better off using DNS, however, redirect is OK too
DJANGO_SECURE_SSL_REDIRECT=False
# Email
# ------------------------------------------------------------------------------
MAILGUN_API_KEY=
DJANGO_SERVER_EMAIL=
MAILGUN_DOMAIN=
# AWS
# ------------------------------------------------------------------------------
DJANGO_AWS_ACCESS_KEY_ID=
DJANGO_AWS_SECRET_ACCESS_KEY=
DJANGO_AWS_STORAGE_BUCKET_NAME=
# django-allauth
# ------------------------------------------------------------------------------
DJANGO_ACCOUNT_ALLOW_REGISTRATION=True
# Gunicorn
# ------------------------------------------------------------------------------
WEB_CONCURRENCY=4
# Sentry
# ------------------------------------------------------------------------------
DJANGO_SENTRY_DSN=
看起来你 运行 变成了 an old bug。
您的 auto-generated 长字符串是否以 $
开头?如果是这种情况,它会导致 django-environ 尝试插入值并崩溃。尝试 re-generating 这些,应该可以解决问题。