如何在Docker上从ascii postgresql数据库切换到utf8?

我有一个问题,在我的docker打击,我试图创build一个超级用户在Django使用docker-compose exec web python manage.py createsuperuser但我有下面这个错误。

 Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose\cli\main.py", line 68, in main File "compose\cli\main.py", line 118, in perform_command File "compose\cli\main.py", line 431, in exec_command File "compose\cli\main.py", line 1236, in call_docker File "distutils\spawn.py", line 220, in find_executable File "ntpath.py", line 85, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 8: ordinal not in range(128) Failed to execute script docker-compose 

我想这是因为我的数据库Postgresql编码为'ascii'而不是utf-8,那么将我的psql数据库编码为utf-8的命令是什么?


Dockerfile

 FROM python:3.5 ENV PYTHONUNBUFFERED 1 RUN mkdir /config ADD /config/requirements.pip /config/ RUN pip install -r /config/requirements.pip RUN mkdir /src; WORKDIR /src 

泊坞窗,compose.yml

 version: '2' services: nginx: image: nginx:latest container_name: NGINX ports: - "8000:8000" volumes: - ./src:/src - ./config/nginx:/etc/nginx/conf.d - /static:/static - /media:/media depends_on: - web web: restart: always build: . container_name: DJANGO command: bash -c "python manage.py collectstatic --noinput && python manage.py makemigrations && python manage.py migrate && gunicorn oqtor.wsgi -b 0.0.0.0:8000" depends_on: - db volumes: - ./src:/src - /static:/static - /media:/media expose: - "8000" db: image: postgres:latest container_name: PSQL 

在docker-compose.yml中有一个代字符(“é”)


编辑。 可能你在所涉及的path中有口音,可能你正在面对主机中的一些python错误。 你可以尝试在主机上更新python(docker-compose是由python创build的)。