Skip to content

Should itsdangerous and Jinja2 be installed in Dockerfile (Chapter 12, Section 6)? #4

@toukoudo

Description

@toukoudo

Problem

In the Chapter 12, Section 6, docker-compose reports error for app_1.

app_1         | Traceback (most recent call last):
app_1         |   File "/app/tracking.py", line 3, in <module>
app_1         |     from flask import Flask, request, Response
app_1         |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 14, in <module>
app_1         |     from jinja2 import escape
app_1         | ImportError: cannot import name 'escape' from 'jinja2' (/usr/local/lib/python3.9/site-packages/jinja2/__init__.py)

Suggestion

I think that itsdangerous and Jinja2 should be installed explicitly like below (c.f. Flask issue).

RUN pip install \
 Flask==1.1.2 \
 redis==3.5.3 \
 Flask_Injector==0.12.3 \
 prometheus-client==0.10.1 \
 jaeger-client==4.4.0 \
 opentracing==2.4.0 \
 'Werkzeug<2.0.0' \
 Flask-OpenTracing==1.1.0 \
 itsdangerous==2.0.1 \
 Jinja2==3.0.3

(The versions of its dangerous and Jinja2 are just example. No specific reason.)

With this change, the docker-compose error resolved and API request(http://localhost:8000/test) succeeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions