Python 烧瓶不';t使用moment.js显示UTC时间

Python 烧瓶不';t使用moment.js显示UTC时间,python,flask,web-applications,momentjs,Python,Flask,Web Applications,Momentjs,我想使用flask获取当前UTC时间,因此我编写了以下代码: from flask import Flask from flask_moment import Moment from flask import render_template from datetime import datetime app = Flask(__name__) moment = Moment(app) @app.route('/') def index(): return render_templa

我想使用flask获取当前UTC时间,因此我编写了以下代码:

from flask import Flask
from flask_moment import Moment
from flask import render_template
from datetime import datetime

app = Flask(__name__)
moment = Moment(app)


@app.route('/')
def index():
    return render_template('index.html', current_time=datetime.utcnow())
<p>The local date and time is {{ moment(current_time).format('LLL') }}.</p>
<p>That was {{ moment(current_time).fromNow(refresh=True) }}</p>
index.html
包含以下代码:

from flask import Flask
from flask_moment import Moment
from flask import render_template
from datetime import datetime

app = Flask(__name__)
moment = Moment(app)


@app.route('/')
def index():
    return render_template('index.html', current_time=datetime.utcnow())
<p>The local date and time is {{ moment(current_time).format('LLL') }}.</p>
<p>That was {{ moment(current_time).fromNow(refresh=True) }}</p>

问题出在哪里?我如何解决它?

如果您检查页面源代码,您会看到内容在那里,但是
span
标记有一个内联
style=“display:none”
CSS,它从实际视图中隐藏了内容。要解决这个问题,您需要在
模板/index.html
中包含即时脚本


瓶子力矩UTC当前时间
{{moment.include{jquery()}}
{{时刻。包括{u时刻()}}
本地日期和时间为{moment(current_time).format('LLL')}

那是{时刻(当前时间)。从现在开始(刷新=真)}