From 2e045fc0d8e33b3045ce58dbc6151fcd3c9fcc21 Mon Sep 17 00:00:00 2001 From: Kakune55 Date: Thu, 26 Dec 2024 10:23:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 9 +++++---- {web => router}/api.py | 0 router/page.py | 8 ++++++++ service/init.py | 7 +++++++ templates/index.html | 23 +++++++++++++++++++++++ web/page.py | 3 --- 6 files changed, 43 insertions(+), 7 deletions(-) rename {web => router}/api.py (100%) create mode 100644 router/page.py create mode 100644 service/init.py create mode 100644 templates/index.html delete mode 100644 web/page.py diff --git a/main.py b/main.py index cfbeb84..5bf4f2e 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,12 @@ from flask import * from init import init_all +from service.init import run_kafka_spark from conf.util import * # from web import app -from web.api import api_bp -from web.page import page_bp +from router.api import api_bp +from router.page import page_bp app = Flask(__name__) @@ -22,9 +23,9 @@ if __name__ == '__main__': init_all() # 运行Kafka与Spark相关 - # run_kafka_spark() + run_kafka_spark() # 运行Web服务 - app.run(host=conf.get('web', 'host'), port=conf.get('web', 'port'), debug=conf.get('web', 'debug')) + app.run(host=conf.get('server', 'listen'), port=conf.get('server', 'port'), debug=conf.get('server', 'debug')) diff --git a/web/api.py b/router/api.py similarity index 100% rename from web/api.py rename to router/api.py diff --git a/router/page.py b/router/page.py new file mode 100644 index 0000000..13b0e16 --- /dev/null +++ b/router/page.py @@ -0,0 +1,8 @@ +from flask import Blueprint +from flask import render_template + +page_bp = Blueprint('page', __name__) + +@page_bp.route('/') +def index(): + return render_template('index.html') diff --git a/service/init.py b/service/init.py new file mode 100644 index 0000000..78cbdc5 --- /dev/null +++ b/service/init.py @@ -0,0 +1,7 @@ +import threading +from service.test import test +def run_kafka_spark(): + print('run_kafka_spark') + t1 = threading.Thread(target=test) + t1.start() + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..bbd6d5f --- /dev/null +++ b/templates/index.html @@ -0,0 +1,23 @@ + + + + + + 哇哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦 + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa magnam dicta harum sit voluptas, explicabo sed cumque omnis. Culpa, reiciendis numquam atque quod id molestiae nobis similique placeat eos amet. + + + \ No newline at end of file diff --git a/web/page.py b/web/page.py deleted file mode 100644 index c18e1fa..0000000 --- a/web/page.py +++ /dev/null @@ -1,3 +0,0 @@ -from flask import Blueprint - -page_bp = Blueprint('page', __name__) \ No newline at end of file