Skip to content

Instantly share code, notes, and snippets.

@attila5287
Created October 26, 2018 11:33
Show Gist options
  • Save attila5287/0ed35e15ec9e04669a899c97797f492d to your computer and use it in GitHub Desktop.
Save attila5287/0ed35e15ec9e04669a899c97797f492d to your computer and use it in GitHub Desktop.
DU week 10 - flask web framework app
# 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