Forums

Not able to deploy site anymore

Hi, I installed a couple of modules and now my site is not working. I get the following error. This happened after upgrading setuptools I believe.

 Error running WSGI application
2023-04-05 15:52:03,610: ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/home/luislaviano/.virtualenvs/stockapp/lib/python3.7/site-packages/werkzeug/security.py)
2023-04-05 15:52:03,610:   File "/var/www/luislaviano_pythonanywhere_com_wsgi.py", line 83, in <module>
2023-04-05 15:52:03,610:     from app import app as application  # noqa
2023-04-05 15:52:03,610: 
2023-04-05 15:52:03,610:   File "/home/luislaviano/.virtualenvs/stockapp/app.py", line 45, in <module>
2023-04-05 15:52:03,610:     import choferes as chofi
2023-04-05 15:52:03,611: 
2023-04-05 15:52:03,611:   File "/home/luislaviano/.virtualenvs/stockapp/choferes.py", line 21, in <module>
2023-04-05 15:52:03,611:     from flask_httpauth import HTTPBasicAuth
2023-04-05 15:52:03,611: 
2023-04-05 15:52:03,611:   File "/home/luislaviano/.virtualenvs/stockapp/lib/python3.7/site-packages/flask_httpauth.py", line 17, in <module>
2023-04-05 15:52:03,611:     from werkzeug.security import safe_str_cmp

[edit by admin: formatting]

It looks like you've upgraded werkzeug to a version that isn't compatible with the version of flask_httpauth that you're using; the function safe_str_cmp was removed from werkzeug recently, according to this post. You should find out if there's a more recent flask_httpauth that is compatible with newer versions of werkzeug, or downgrade werkzeug to a version that's compatible with flask_httpauth (it looks like that would be whatever version came before 2.1.0).