250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- UDF
- API
- integrated gradient
- Airflow
- GCP
- GenericGBQException
- 공분산
- Retry
- BigQuery
- flask
- spark udf
- grad-cam
- XAI
- 상관관계
- chatGPT
- Counterfactual Explanations
- subdag
- session 유지
- tensorflow text
- 유튜브 API
- hadoop
- API Gateway
- youtube data
- TensorFlow
- requests
- airflow subdag
- login crawling
- gather_nd
- correlation
- top_k
Archives
- Today
- Total
데이터과학 삼학년
flask http 요청 핸들러 본문
반응형
Flask http 요청 핸들러 데코레이터 정리
# -*- encoding:utf8 -*-
from flask import Flask
app = Flask(__name__)
@app.route("/")
def main():
print("/")
return "/"
@app.before_first_request
def before_first_request():
print("앱이 기동되고 나서 첫 번째 HTTP 요청에만 응답")
@app.before_request
def before_request():
print("매 HTTP 요청이 처리되기 전에 실행")
@app.after_request
def after_request(response):
print("매 HTTP 요청이 처리되고 나서 실행")
return response
@app.teardown_request
def teardown_request(exception):
print("매 HTTP요청의 결과가 브라우저에 응답하고 나서 호출")
@app.teardown_appcontext
def teardown_appcontext(exception):
print("HTTP요청의 어플리케이션 컨텍스트가 종료될때 실행")
728x90
반응형
LIST
'Web' 카테고리의 다른 글
로그인 기능 추가 --> 다 만든 web에 로그인만 입히기 (0) | 2020.03.06 |
---|---|
flask request (0) | 2020.03.05 |
SSO (Single Sign On) (0) | 2020.02.11 |
NGINX와 uWSGI (0) | 2020.02.10 |
nohup을 이용해서 데몬에 web 서버 띄우기 (0) | 2020.02.07 |
Comments