Created
October 26, 2018 11:33
-
-
Save attila5287/0ed35e15ec9e04669a899c97797f492d to your computer and use it in GitHub Desktop.
DU week 10 - flask web framework app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. import Flask | |
from flask import Flask | |
# 2. Create an app, being sure to pass __name__ | |
app = Flask(__name__) | |
# 3. Define what to do when a user hits the index route | |
@app.route("/") | |
def home(): | |
print("Server received request for 'Home' page...") | |
return "Welcome to my 'Home' page!" | |
# 4. Define what to do when a user hits the /about route | |
@app.route("/ about") | |
def about(): | |
print("Server received request for 'About' page...") | |
return "Welcome to my 'About' page!" | |
if __name__ == "__main__": | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment