Aug-31-2020, 07:52 PM
Hi there I need urgent help I have been stuck on this for days now,
in my code I need to use the function generate_password_hash which is in bcrypt but returns the following error: AttributeError: 'module' object has no attribute 'generate_password_hash'
Anyone has any idea? what's wrong?
in my code I import the following:
from flask import Flask
from flask_bcrypt import bcrypt
then in the code I use the function as following in a class:
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(64), unique=True)
pwd = db.Column(db.String(128))
def __init__(self,username,pwd):
self.username=username
self.pwd=bcrypt.generate_password_hash(pwd)
I checked and bcrypt is installed under venv environment
pip show flask-bcrypt
Name: Flask-Bcrypt
Version: 0.7.1
Summary: Brcrypt hashing for Flask.
Home-page: https://github.com/maxcountryman/flask-bcrypt
Author: Max Countryman
Author-email: [email protected]
License: BSD
Location: /home/itad/DICP_evo_dev/venv/lib/python2.7/site-packages
Requires: bcrypt, Flask
Required-by:
in my code I need to use the function generate_password_hash which is in bcrypt but returns the following error: AttributeError: 'module' object has no attribute 'generate_password_hash'
Anyone has any idea? what's wrong?
in my code I import the following:
from flask import Flask
from flask_bcrypt import bcrypt
then in the code I use the function as following in a class:
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(64), unique=True)
pwd = db.Column(db.String(128))
def __init__(self,username,pwd):
self.username=username
self.pwd=bcrypt.generate_password_hash(pwd)
I checked and bcrypt is installed under venv environment
pip show flask-bcrypt
Name: Flask-Bcrypt
Version: 0.7.1
Summary: Brcrypt hashing for Flask.
Home-page: https://github.com/maxcountryman/flask-bcrypt
Author: Max Countryman
Author-email: [email protected]
License: BSD
Location: /home/itad/DICP_evo_dev/venv/lib/python2.7/site-packages
Requires: bcrypt, Flask
Required-by: