install flask and run HelloWorld webapp
(venv) lindas-MacBook-Air:hello linda$ pip3 install flask
(venv) lindas-MacBook-Air:hello linda$ export FLASK_APP=hello.py
(venv) lindas-MacBook-Air:hello linda$ export FLASK_DEBUG=1
(venv) lindas-MacBook-Air:hello linda$ flask run
(venv) lindas-MacBook-Air:hello linda$ cat hello.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
(venv) lindas-MacBook-Air:hello linda$ flask run
* Serving Flask app "hello.py" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 337-750-709
if you add below two lines into hello.py:
if __name__ == "__main__":
app.run()
you can start app with: python3 hello.py directly!