How to change default host and port in Flask?

Answer

Flask default host and port can be changed by passing the values to host and port parameters while calling run method on the app.

from flask import Flask
app = Flask(__name__)
 
@app.route("/")
def index():
    return "Hello, World!"
 
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)

All flask Questions

Ask your interview questions on flask

Write Your comment or Questions if you want the answers on flask from flask Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---