problem with werkzeug and flask in nginx-flask-mysql
iyad-obeid opened this issue · comments
There is some sort of version / dependency issue with Flask and Werkzeug:
cd nginx-flask-mysql
docker compose up
Crashes with the following trace, over and over:
nginx-flask-mysql-backend-1 | Traceback (most recent call last):
nginx-flask-mysql-backend-1 | File "/usr/local/bin/flask", line 5, in <module>
nginx-flask-mysql-backend-1 | from flask.cli import main
nginx-flask-mysql-backend-1 | File "/usr/local/lib/python3.10/site-packages/flask/__init__.py", line 7, in <module>
nginx-flask-mysql-backend-1 | from .app import Flask as Flask
nginx-flask-mysql-backend-1 | File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 28, in <module>
nginx-flask-mysql-backend-1 | from . import cli
nginx-flask-mysql-backend-1 | File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 18, in <module>
nginx-flask-mysql-backend-1 | from .helpers import get_debug_flag
nginx-flask-mysql-backend-1 | File "/usr/local/lib/python3.10/site-packages/flask/helpers.py", line 16, in <module>
nginx-flask-mysql-backend-1 | from werkzeug.urls import url_quote
nginx-flask-mysql-backend-1 | ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.10/site-packages/werkzeug/urls.py)
nginx-flask-mysql-backend-1 exited with code 1
This is a version problem. I had the same. I haven't looked much into it to understand the real issue, however, I found that those two versions work together. :
Werkzeug==2.3.7
flask==2.2.2
That did the trick! You might consider making that change to the repo, it would be really helpful. Thanks!
bumping the flask version should work too
Flask==3.0.3
mysql-connector==2.2.9
More info here: https://stackoverflow.com/a/77214086
So, you can use libs without number version, like:
Flask
mysql-connector
In this way, you'd use the latest versionof the libraries.