Issue
I am developing an app in repl.it, when I run the code this is output:
* Serving Flask app 'main' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
this is my main.py:
from flask import Flask, request, render_template
import subprocess
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
if __name__ == "__main__":
app.run()
but I am unable to open 127.0.0.1:5000 and I'm not sure why or how to fix it; would really appreciate any help, thank you
Solution
For running flask in repl.it, make sure you're using their flask template. Afterwards, change your app.run to:
app.run(host="0.0.0.0", port=8080)
And while running, a window should appear with the site above the terminal. You should also be able to access it via https://[project name].[replit username].repl.co
You can see an example here at the bottom: https://replit.com/talk/learn/Flask-Tutorial-Part-1-the-basics/26272
Answered By - Daniel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.