#20250228

플라스크 또는 장고를 이용한 로그 분석 시스템 구축

로그 데이터 : 192.168.0.118
센서 데이터 : 192.168.0.98

CI4 > Model, View, Controller (MVC)
Flask, Django > Model, Template, View (MTV)


FLASK

기본 경로 세팅
__init__.py
/views/
/templates

[__init__.py]

from flask import Flask

def create_app():
   app=Flask(__name__)

   from .views import main
   from .views import syslog
   from .views import sensor

   app.register_blueprint(main.bp)
   app.register_blueprint(syslog.bp)
   app.register_blueprint(sensor.bp)

   return app

[/views/main.py]

from flask import Blueprint, render_template

bp=Blueprint('main', __name__, url_prefix='/')

@bp.route('/')
def index():
   return "main"

@bp.route('/profile')
def profile():
   return render_template('main/profile.html') #/templates/main/profile.html

@bp.route('/init')
def init():
   return render_template('main/init.html') #/templates/main/init.html



우분투에 플라스크 서버 세팅