Flaskbootstrap简单应用程序无法正确呈现引导

2024-10-17 06:23:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我遇到了一些问题,要得到一个简单的flask应用程序来使用flask引导包。在

根据文档,我安装了flaskbootstrap,创建了下面的2个文件,这个文件运行得很好。我面临的问题是索引.html在浏览器中,我只看到文本引导/基本.html返回,当我查看源代码时,没有看到对引导css文件的引用。在

感谢你对我在这里遗漏了什么的指导。 谢谢。在

初始化py

from flask import Flask, render_template

from flask.ext.bootstrap import Bootstrap 

app = Flask(__name__)
bootstrap = Bootstrap(app)

@app.route("/")
def homepage():
    return render_template('index.html')

if __name__ == "__main__":
    app.run(debug=True)

索引.html

^{pr2}$

Tags: 文件namefrom文档importapp应用程序flask
1条回答
网友
1楼 · 发布于 2024-10-17 06:23:25

感谢您提供有关virtualenv的设置和正确使用的提示。在

经过进一步的挖掘,我发现应该在的顶部添加以下两行烧瓶app.wsgi因为我在为我的应用程序创建的虚拟环境上安装了引导程序,即venv

activate_this = '/var/www/FlaskApp/FlaskApp/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

相关问题 更多 >