使用flask-socketio无法正常显示网页样式

写了一段向 index.html 广播消息的code,并也可以正常广播到前端,
同时利用 style.css 的档案来设置网页 index.html 的样式,单独开启时可以显示所有样式,

可是当我运行flask-socketio 并用 http://127.0.0.1:5000 开启网页时,样式、颜色却全部都消失了?只剩下文字。
想请问该如何解决呢?

謝謝!


Python code:

@socketio.on('connect', namespace=name_space)
def connected_msg():
    print('client connected!')
    global thread
    with thread_lock:
        if thread is None:
            thread = socketio.start_background_task(target = push_once)
    
# @app.route('/push')
def push_once():
    while True:
        socketio.sleep(10)
        event_name = 'abcde'
        t = get_price()
        broadcasted_data = {'data': t}
        socketio.emit(event_name, broadcasted_data, broadcast=True, namespace=name_space)

JS code:

<script>
$(document).ready(function () {
    namespace = '/abcd';
    var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + namespace, {transports: ['websocket']});
    socket.on('abcde', function (res) {
        var t = res.data;
        if (t) {
            $("#test-price").prepend( ('<p>') + t );

            if ($("#test-price").children().length > 5 ){
                $("#test-price").children().get($("#test-price").children().length - 1).remove();
            }
        }

    });
});
</script> 

 

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答

本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。

​​​​因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。