2017-06-29 112 views
1

我在我的docker bash中遇到問題,我試圖在django上使用docker-compose exec web python manage.py createsuperuser創建一個超級用戶,但我在下面有這個錯誤。如何在docker上從ascii postgresql數據庫切換到utf8?

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的在代替UTF-8「ASCII」編碼,什麼是編碼我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 

回答

1

你在你的搬運工,compose.yml有波浪符( 「​​E」)


編輯。可能你在所涉及的路徑中有口音,並且可能你正在面對主機中的一些python錯誤。您可以嘗試更新主機中的python(docker-compose是由python製作的)。

+0

我不這樣做,我已經檢查過,我已經發布了我的文件 – jjyoh

+1

可能您在所涉及的路徑中有重音符號?碼頭工人組成的地方。 – Robert

+0

是的,我找到了帶口音的路徑...謝謝 – jjyoh