feat:添加服务进程管理
This commit is contained in:
parent
562b1add2a
commit
2e045fc0d8
9
main.py
9
main.py
@ -1,11 +1,12 @@
|
|||||||
from flask import *
|
from flask import *
|
||||||
|
|
||||||
from init import init_all
|
from init import init_all
|
||||||
|
from service.init import run_kafka_spark
|
||||||
from conf.util import *
|
from conf.util import *
|
||||||
|
|
||||||
# from web import app
|
# from web import app
|
||||||
from web.api import api_bp
|
from router.api import api_bp
|
||||||
from web.page import page_bp
|
from router.page import page_bp
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -22,9 +23,9 @@ if __name__ == '__main__':
|
|||||||
init_all()
|
init_all()
|
||||||
|
|
||||||
# 运行Kafka与Spark相关
|
# 运行Kafka与Spark相关
|
||||||
# run_kafka_spark()
|
run_kafka_spark()
|
||||||
|
|
||||||
# 运行Web服务
|
# 运行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'))
|
||||||
|
|
||||||
|
|
||||||
|
8
router/page.py
Normal file
8
router/page.py
Normal file
@ -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')
|
7
service/init.py
Normal file
7
service/init.py
Normal file
@ -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()
|
||||||
|
|
23
templates/index.html
Normal file
23
templates/index.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-cn">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>哇哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
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.
|
||||||
|
<ul>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>123</li>
|
||||||
|
<li>132</li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,3 +0,0 @@
|
|||||||
from flask import Blueprint
|
|
||||||
|
|
||||||
page_bp = Blueprint('page', __name__)
|
|
Loading…
x
Reference in New Issue
Block a user