Skip to content

Instantly share code, notes, and snippets.

@atmb4u
Created September 26, 2014 04:39
Show Gist options
  • Save atmb4u/acee78f13bebec000681 to your computer and use it in GitHub Desktop.
Save atmb4u/acee78f13bebec000681 to your computer and use it in GitHub Desktop.
basic helloworld in flask
# import Flask object from flask library
# you can install flask by pip install flask
from flask import Flask
# initialize Flask app with the name of the file
app = Flask(__name__)
# define the url for which the application should send an http response to
@app.route('/')
# plain python function to handle the request
def hello_world():
# expected return from the function for the request (to the browser)
return "Hello World!"
# executed the above defined Flask app
if __name__ == '__main__':
# initialize the app by invoking the Flask function run()
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment