nc나 make menuconfig 처럼 실행시 혹은 동적으로 창 크기나 비율을 어떻게 조절하나 궁금해짐
Name getyx, getparyx, getbegyx, getmaxyx - get curses cursor and window coordinates
Synopsis #include <curses.h>
void getyx(WINDOW *win, int y, int x); void getparyx(WINDOW *win, int y, int x); void getbegyx(WINDOW *win, int y, int x); void getmaxyx(WINDOW *win, int y, int x);
Flask 에 static_url_path와 static_folder 를 설정해서 정적으로 서빙할 경로를 지정한다.
template_folder는 template engine를 위한 경로 같긴한데, 지금은 그걸 하려는게 아니니 패스~ 하고
/ 로 요청이 들어오면 index.html을 던지도록 라우터 하나 설정하고
나머지는 자동으로 static 경로 하위에서 제공
그리고 /api 쪽은 별도로 라우터 지정해서 2개의 api를 생성해준다.
/app.py
from flask import Flask, jsonify, render_template
app = Flask(__name__,
static_url_path='',
static_folder='static',
template_folder='templates')
@app.route('/')
def serve_index():
return app.send_static_file('index.html')
# REST API 라우트
@app.route('/api/hello')
def api_hello():
return jsonify({"message": "Hello, this is a REST API response!"})
# 또 다른 REST API
@app.route('/api/sum/<int:a>/<int:b>')
def api_sum(a, b):
return jsonify({"a": a, "b": b, "sum": a + b})
if __name__ == "__main__":
# 디버그 모드 실행
app.run(debug=True)
$ python3 app.py * Serving Flask app 'app' * Debug mode: on WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on http://127.0.0.1:5000 Press CTRL+C to quit * Restarting with stat * Debugger is active! * Debugger PIN: 997-788-229