Monday, May 18, 2020

Python Flask

Python Flask restful web service

1. Install Python3 and flask (my python is 3.8.0)
2. Make a hello.py accordign to the flask quick start
https://flask.palletsprojects.com/en/1.1.x/quickstart/#quickstart

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'
3.On windows, from command line, run "FLASK_APP=hello.py"
 and flask run --host=0.0.0.0 --port=80
4. Other computer on the same LAN now is able to access the service (virtualbox needs to be 
bridge adapter)

2 comments:

  1. Space smells like seared steak.

    ReplyDelete
  2. Bees sometimes sting other bees.

    ReplyDelete