I set up a flask project using VS2015. The code is as follows:
views.py:
from datetime import datetime
from flask import render_template
from flask import Flask
from FlaskWebProject1 import app
@app.route("/")
@app.route("/home")
def home():
return render_template(
"index.html",
title="Home Page"
)
@app.route("/greeting/<surname>/<lastname>")
def greeting(surname,lastname):
return ("Hello "+surname+" "+lastname)
runserver.py:
"""
This script runs the FlaskWebProject1 application using a development server.
"""
from os import environ
from FlaskWebProject1 import app
if __name__ == "__main__":
HOST = environ.get("SERVER_HOST", "localhost")
try:
PORT = int(environ.get("SERVER_PORT", "5555"))
except ValueError:
PORT = 5555
app.run(host = "0.0.0.0", port = 8081, debug = False)
according to flask"s official tutorial:
host0.0.0.0:Running on http://0.0.0.0:8081/
cmd ipconfig/all IP192.168.1.101IP
"IP" IP183.62.69.42IP
192.168.1.101:8081/greeting/a/b
183.62.69.42:8081/greeting/a/b
webservice
ipconfig: