Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

877
Visualizações
when i use docker-compose to install a fastapi project, i got AssertionError:

when I use docker-compose to install a fastapi project, I got AssertionError: jinja2 must be installed to use Jinja2Templates

but when I use env to install it, that will be run well.

my OS:

Ubuntu18.04STL

my requirements.txt:

fastapi~=0.68.2
starlette==0.14.2
pydantic~=1.8.1

uvicorn~=0.12.3
SQLAlchemy~=1.4.23

# WSGI
Werkzeug==1.0.1

pyjwt~=1.7.0

# async-exit-stack~=1.0.1
# async-generator~=1.10

jinja2~=2.11.2

# assert aiofiles is not None, "'aiofiles' must be installed to use FileResponse"
aiofiles~=0.6.0
python-multipart~=0.0.5

requests~=2.25.0
pyyaml~=5.3.1
# html-builder==0.0.6
loguru~=0.5.3
apscheduler==3.7.0

pytest~=6.1.2
html2text==2020.1.16
mkdocs==1.2.1

Dockerfile

FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /server
COPY requirements.txt /server/
RUN pip install -r requirements.txt
COPY . /server/

docker-compose.yml

version: '3.7'

services:
  figbox_api:
    build:
        context: .
        dockerfile: Dockerfile
    command:  uvicorn app.main:app --port 8773 --host 0.0.0.0 --reload
    volumes:
    - .:/server
    ports:
    - 8773:8773

Do I need to provide some other information?

Thanks

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I had a same problem on heroku, the error comes from Jinja2 version 2.11.x and it run locally but not in Heroku.

Just install latest version of jinja2 it will work fine in your case too.

pip install Jinja2==3.1.2
or 
pip install Jinja2 --upgrade
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda