Here is a basic example of a Flask web application in Python:
main.py145 chars11 lines
In this example, we are creating a Flask object, defining a route for the home page, and returning a simple greeting. The if __name__ == '__main__':
block runs the development server when the script is executed directly.
To run the application, save the file with a .py
extension and execute it in your terminal with python filename.py
. The server should start running on http://localhost:5000/
.
gistlibby LogSnag