8000 Should itsdangerous and Jinja2 be installed in Dockerfile (Chapter 12, Section 6)? · Issue #4 · PacktPublishing/Expert-Python-Programming-Fourth-Edition · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
toukoudo opened this issue Apr 1, 2022 · 0 comments

Comments

@toukoudo
Copy link
toukoudo commented Apr 1, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant
0