참치코더의 꿈 메모장

Python / 파이썬 flask 웹 서버 연결(feat. 노마드 코더) 본문

파이썬

Python / 파이썬 flask 웹 서버 연결(feat. 노마드 코더)

참치깡 2026. 1. 17. 19:06
728x90

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# py -m pip install flask // flask 라이브러리 다운로드 , 현재 파일은 main.py
from flask import Flask, render_template
 
app = Flask("JobScrapper")
 
@app.route("/"# / 요청 반환 함수 작성
def home():  
    return render_template("home.html"# 문자를 반환할 수도 있다.
 
@app.route("/search"# /search 요청 반환 함수 작성
def hello():
    return render_template("search.html"# 각 templates 안에 html 파일을 입력해야 한다.
 
app.run("0.0.0.0")
 
 
# templates 같은 트리 레벨 상에 main.py가 있어야 하고 templates 안에는 render_template가 실행할 파일이 있어야 한다.
cs
728x90
Comments