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
Nexmon is our C-based firmware patching framework for Broadcom/Cypress WiFi chips that enables you to write your own firmware patches, for example, to enable monitor mode with radiotap headers and frame injection.
When a flowgraph which has been generated by version 3.7 is opened in GRC version 3.8, much of the conversion process is done automatically. However, there are certain things which must be updated by hand.
WX GUI blocks: Since the WX GUI blocks are deprecated in version 3.8, the user must find corresponding blocks in the QT GUIs.
If blocks have different names between versions 3.7 and 3.8, they must be replaced by hand.