1# Extremely simple flask application, will display 'Hello World!' on the screen when you run it
2# Access it by running it, then going to whatever port its running on (It'll say which port it's running on).
3from flask import Flask
4app = Flask(__name__)
5
6@app.route('/')
7def hello_world():
8 return 'Hello, World!'
9
10if __name__ == '__main__':
11 app.run()
1from flask import Flask
2app = Flask(__name__)
3
4@app.route('/')
5def hello_world():
6 return 'Hello, World!'
7
1from flask import Flask
2app = Flask(__name__)
3
4@app.route('/')
5def hello_world():
6 return 'Hello World’
7
8if __name__ == '__main__':
9 app.run()
1#Import Flask, if not then install and import.
2
3import os
4try:
5 from flask import *
6except:
7 os.system("pip3 install flask")
8 from flask import *
9
10app = Flask(__name__)
11
12@app.route("/")
13def index():
14 return "<h1>Hello World</h1>"
15
16if __name__ == "__main__":
17 app.run(host="0.0.0.0", port=8080, debug=False)
1from flask import Flask
2app = Flask(__name__)
3
4@app.route('/')
5def hello_world():
6 return 'Hello, World!'
7
8if __name__ == '__main__':
9 app.run()
1'''
2use python and flask(one of the best web frameworks in python)
3as the server-side language and control the look of your web app
4using the front-end languages - html,css, and js...[TRY THE "MVC(model-visual-controlling)" METHOD]
5'''
6from flask import Flask, render_template #importing the module Flask and its attributes...
7
8app = Flask(__name__)
9@app.route('/')
10
11def index():
12 return render_template('index.html') #using the index.html file for visual controlling...
13
14
15if __name__=="__main__":
16 app.run()
17
18'''
19TODO:
20<exremely important>
21make sure that you :
22 Create a new folder called "templates" in the same directory where your python file is saved ,and create a new html file called "index.html", and write your html code there...
23 Store all assets and other files(including css files,images,videos,js files,and other html files{if any}) in the same "templates" folder...
24'''