-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathhello.py
More file actions
14 lines (14 loc) · 791 Bytes
/
hello.py
File metadata and controls
14 lines (14 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from flask import Flask, render_template # Import Flask to allow us to create our app.
app = Flask(__name__)
# Global variable __name__ tells Flask whether or not we are running the file
# directly, or importing it as a module.
@app.route('/')
@app.route('/success')
def success():
return render_template('success.html') # The "@" symbol designates a "decorator" which attaches the following
# function to the '/' route. This means that whenever we send a request to
# localhost:5000/ we will run the following "hello_world" function.
def hello_world():
return render_template('index.html')
# Return the string 'Hello World!' as a response.
app.run(debug=True) # Run the app in debug mode.