티스토리 뷰

[index01()]

  • import render_template
from flask import Flask, render_template

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>
    '''

@app.route('/index01')
def index01():
    return render_template("index01.html")

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

 

 

반응형

'SWDesk > Web' 카테고리의 다른 글

게시된 글에 팁(주석) 표시하기  (3) 2025.09.27
Major Network Protocols  (0) 2024.09.11
[Flask in Python - 005] HTML Rendering  (2) 2024.02.06
[Flask in Python - 004] Dynamic Access  (2) 2024.02.06
[Flask in Python - 003] Connecting a webpage  (0) 2024.02.06
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/01   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함