ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security'
This page explains How to Fix ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security'
Werkzeug, the core dependency of Flask, is a comprehensive WSGI web application library.
Version v2.1.0 deprecates a few helpers, including safe_str_cmp.
Here is the update history:
v2.0.0
pbkdf2_hex
,pbkdf2_bin
, andsafe_str_cmp
are deprecated.hashlib
andhmac
provide equivalents.
v2.1.0
Remove the
pbkdf2_hex
,pbkdf2_bin
, andsafe_str_cmp
functions. Use equivalents inhashlib
andhmac
modules instead.
✅ How to Fix
Freeze the Werkzeug
to the latest stable version prior to v2.1.0. The recommended version is Werkzeug==2.0.3.
✅ Sample Project
To see this hot fix in action, feel free to check this sample project saved on Github (MIT License)
Flask Datta Able - open-source Flask Starter generated by AppSeed
- 👉 Datta Able Flask - Source Code
- 👉 Datta Able Flask - LIVE deployment
✅ Resources
- 👉 Access AppSeed and start your next project
- 👉 Deploy Projects on Aws, Azure and Digital Ocean via DeployPRO
- 👉 Create an amazing landing page with Simpllo, an open-source site builder
- 👉 Django App Generator - A 2nd generation App Builder