Problem description:
I have tried several ways to use Python Flask on Replit and nothing works anymore. I use templates, fork Repls (and change nothing), and it never works. Usually the main page (index.html) works, but all other pages don’t. I keep checking status.replit.com and nothing is there to address this.
Expected behavior:
I expect Flask Repls, especially unaltered forks of working Repls and ones made from templates to work, but they no longer do. Actual behavior:
When using any page other than the main page, I get this:
Steps to reproduce:
I tried this with an alt account too and same problem, so it is not just my account. I forked CodingCactus’ “Cactus Pinger” among other things, made no changes, and that is what I get after clicking the button (clicking the button changes you over to a different HTML file).
Bug appears at this link: https://replit.com/@CoderElijah/Cactus-Pinger?v=1 Click on that, click “Ping me”, and watch Flask fail. This is an unedited 1:1 copy of the original, yet mine doesn’t work and the original does.
Browser/OS/Device:
How is this relevant? Anyway, Firefox/Linux Mint 21/Lenovo Laptop.
EDIT:
Just FYI, there are ways around using Python Flask to make websites. Since Flask is not working right for me, I have combined several HTML/JavaScript templates and made CoderElijah.repl.co without Flask, yet having Error 404, .html removed from URL, etc. It’s possible to live without Flask but I really like Python and would love to get it working.
I am unlucky with Replit. I had a Python program whose description said it was four hundred fifty five bytes (number form, not word form), and the moderator bot found it to be an offensive word and blacklisted it.
This could be that there is a database key that has been set up on the original but has not been set up on this one. I believe that this is db["pings"]
How do I fix that?
I found two other Flask Repls. This one has major issues for reasons I cannot understand, and this one works. What is the difference?
I don’t see any difference in code other than you removing some variables; however, this could be an error with importing the entire library. Instead of importing the entire thing for functions I may not use, I do something like:
So I got all of them fixed except the Cactus one. It seems that in Flask HTML files you must use the full URL in links instead of the HTML file name like you normally would. The Cactus pinger still makes no sense.
I already fixed this error; when he invited me to the repl, I noticed that it was returning an error stating that the key “pings” did not exist in the database and I explained why, and I simply did what you mentioned.
Apparently there can only be one solution. So, I marked @functionally’s answer as the solution because they are the one that actually fixed the program. However, @GoodVessel92551 also had this answer. Thanks to both of you! It was because of @GoodVessel92551’s comments that I thought to check the URLs, and @functionally solved it. I now follow both of you.