I have deployed a Flask app on Ubuntu 22.04 KVM2, and the login page is displayed successfully. MongoDB is also linked to the VPS IP address, and I can access it from the Flask app without any issues. I have used os.path.abspath to reference the templates folder where dashboard.html is located. When I enter incorrect credentials, the message "Invalid username or password" appears, which indicates that the login process is functioning properly. However, when I enter the correct credentials, it should redirect to dashboard.html, but nothing happens. The login page simply refreshes without redirecting. I suspect the issue may be related to data fetching. To debug, I added print() statements in the code to view the data. When I run the app using python main.py on the terminal, everything works fine on 127.0.0.1:5000. However, when I access it via the VPS IP address, only the login page is visible, and the redirection still doesn't occur. What steps should I take to resolve this issue? If you need more information, please let me know. Continue reading...