728x90
main.py
from flask import Flask
from test_api import test_api
app = Flask(__name__)
app.register_blueprint(test_api)
@app.route('/')
def main():
return "hello"
test_api.py
from flask import Blueprint
test_api = Blueprint('test_api', __name__, url_prefix='/test')
@test_api.route("/here")
def test():
return "here"
flask server 올린 후
request: localhost:5000/
response : hello
request: localhost:5000/test/here
response : here
728x90
'개발 > python, python frameworks' 카테고리의 다른 글
PyInstaller shell 없애기 (0) | 2020.04.21 |
---|---|
python(flask)에서 DTO 활용하기(예제) (0) | 2020.04.03 |
AES256/ base64 암호화 with python (0) | 2020.03.30 |
카카오 로그인 (python에 붙이기) (0) | 2020.03.23 |
댓글