Before proceed, I assumed that you have good knowledge in Python programming language and also in frontend languages like HTML, CSS, JavaScript...
Note: To know about the introduction of Flask click here...
Step 1: Create a new directory for your "Hello World" project...
Step 2: Inside your project's directory create 2 new directories named as "static" and "templates"...
# Place the static contents of your project like CSS, JavaScript, images, etc., inside the "static" directory
# Place your HTML files inside "templates" directory...
Step 3: Create a new python file (eg: filename.py) inside your project directory...
# Default file name: app.py
Step 4: Open the app.py file with your favourite IDE / Code editor...
Step 5: Paste the following codes inside your python file...
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def homepage():
return "Hello World!"
if __name__ == "__main__":
app.run()Step 6: Don't forget to save it...
Step 7: Now run your python file with command prompt / IDE...
Step 8: If your file ran without an error, you will get a server link. Open that link with your browser...
# Default server link: "http://127.0.0.1:5000/"
Note: Congratulation! your Hello World program successfully completed... You can render html files instead of returning HTML contents in your app.py file... For dynamic sites, you can use jinja templates in your HTML files... Use frontend languages effectively to create a beautiful sites...