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
我不這樣做,我已經檢查過,我已經發布了我的文件 – jjyoh
可能您在所涉及的路徑中有重音符號?碼頭工人組成的地方。 – Robert
是的,我找到了帶口音的路徑...謝謝 – jjyoh