Hi! I am also having problems with authentication on the flask. I'm using this same tutorial (https://pythonspot.com/login-authentication-with-flask/). This implementation is working correctly on the virtual server on my PC.
When I login I get from the browser:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Here is my error log:
RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
2020-12-06 14:06:37,915: BEGIN (implicit)
2020-12-06 14:06:37,915: SELECT users.id AS users_id, users.username AS users_username, users.password AS users_password
FROM users
WHERE users.username IN (?) AND users.password IN (?)
LIMIT ? OFFSET ?
2020-12-06 14:06:37,916: ('admin', 'admin', 1, 0)
2020-12-06 14:06:37,922: Exception on /login [POST]
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/snakeproject/app.py", line 29, in do_admin_login
session['logged_in'] = True
File "/usr/lib/python3.8/site-packages/werkzeug/local.py", line 351, in setitem
self._get_current_object()[key] = value
File "/usr/lib/python3.8/site-packages/flask/sessions.py", line 102, in _fail
raise RuntimeError(
RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
I appreciate any help in that regard. Any support material or tutorial that sheds light on this problem. Thank you very much in advance!