티스토리 뷰

 

* Access URL : "123.45.6.7:3771/html02"

from flask import Flask

app = Flask(__name__)

@app.route('/')
@app.route('/home')
def home():
    return 'Hello, world from Bilient'

@app.route('/user')
def user():
    return "This is user-page"

@app.route('/user/<user_name>/<int:user_id>')
def user2(user_name, user_id):
    return f'Welcome {user_name}({user_id})'

@app.route('/html02')
def html02():
    return '''
    <h1> This is the title</h1>
    <p> Below is ...</p>
    <a href="https://bilient.tistory.com"> Connecting HW and SW </a>
    '''


if __name__=="__main__":
    app.run(host='0.0.0.0', port=3771, debug=True)

 

반응형