Hi, I am a teacher, one of my students has an error that I cannot debug.
Using my own repl account this works and produces “hello world” in web view.
from flask import Flask
app = Flask(__name__)
# basic route
@app.route("/")
def root():
return '<h1 style="color:red;">Hello World</h1>'
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=8080)
console out put is:
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://172.31.196.99:8080
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 174-275-786
172.31.196.1 - - [20/Jul/2023 04:04:16] "OPTIONS * HTTP/1.1" 404 -
172.31.196.1 - - [20/Jul/2023 04:04:16] "GET / HTTP/1.1" 200 -
172.31.196.1 - - [20/Jul/2023 04:04:16] "GET / HTTP/1.1" 200 -
Now when the student runs the exact same code, the console output is:
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://172.31.196.13:8080
Press CTRL+C to quit
* Restarting with stat
Python 3.10.8 (main, Oct 11 2022, 11:35:05) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Could anyone help me debug this? We have already tried this in several new student repls with no success. Thanks in advance.