In production, Django doesn't change language. I use Docker. But flags and admin panel language changes

43 Views Asked by At

Project works good in development but doesn't in production.

My Dockerfile is like that


FROM python:3.11.4
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE=mysite.settings
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
RUN apt-get update && \
    apt-get install -y gettext 
RUN apt-get install -y locales locales-all
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
RUN locale-gen
RUN LANG=en_US.UTF-8 python manage.py collectstatic --noinput
EXPOSE 8080
CMD ["gunicorn", "--config", "gunicorn_config.py", "mysite.wsgi:application"]

My settings.py

LANGUAGES = [
    ('az', gettext_noop('Azerbaijani')),
    ('en', gettext_noop('English')),
    ('ru', gettext_noop('Russian')),
]
 
 
LANGUAGE_CODE = 'az'
 
TIME_ZONE = 'Asia/Baku'
 
USE_I18N = True

When i try to makemessages, this occures


UnicodeDecodeError: skipped file requirements.txt in . (reason: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte)
processing locale en_US.UTF-8
processing locale en

0

There are 0 best solutions below