Python Flask Repls don't work (anymore)

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:
Flask Behavior

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.

Hey @CoderElijah,

works perfectly for me!

1 Like

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.

1 Like

Yeah, that might be a moderation tool error. Some moderation tools uses a Node.js package, which isn’t very reliable!

1 Like
  1. Flask works perfectly for you or the link I gave works for you? If both, that’s weird.
  2. Yeah I had one of the non-bot moderators tell me it was the numeric equivalent of letters and so I was a victim of an unfortunate little glitch.
1 Like

I just tried it with Google Chrome on Android. It is not the browser, OS, or device that causes this. Problem was consistent.

1 Like

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"]
Screenshot 2023-02-02 7.15.52 PM

1 Like

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?

1 Like

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:

from requests import get, post, delete
from flask import Flask, render_template, request
1 Like

can you invite me to the repl mentioned in this:

1 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.

2 Likes

You want to run db["pings"] = [] once and then remove it

2 Likes

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.

2 Likes

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.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.