Flask-Web-App-Tutorial
Flask-Web-App-Tutorial copied to clipboard
Attributed error with user.password
When I am trying to log in or just hit enter with the email bar filled in, I get redirected to a faulty page with this is as the error, but I cannot figure out what exactly is going with the encoding.
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2091, in call return self.wsgi_app(environ, start_response)Open an interactive python shell in this frame File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "C:\Users\Reece\OneDrive\Desktop\Flask Lesson\website\auth.py", line 19, in login if check_password_hash(user.password, password): File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\werkzeug\security.py", line 219, in check_password_hash return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval) File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\werkzeug\security.py", line 148, in _hash_internal password = password.encode("utf-8") AttributeError: 'NoneType' object has no attribute 'encode'
I am not sure if .password is not importing properly or if it is something I have to update or install using py3.10.2
in the auth.py file change the line to : password = request.form.get('password1') add the 1 in the end, since this is the name in the form declaration.
in the auth.py file change the line to : password = request.form.get('password1') add the 1 in the end, since this is the name in the form declaration.
Thanks, that solved my problem with the encoding error.