Rom*_*her 6 flask uwsgi webassets flask-assets
当我直接运行烧瓶应用程序时它们正常运行但在uWSGI下运行时不编译或替换模板中的地址.
我该怎么调试呢?
编辑:
代码:assets =环境(app)
...
if __name__ == "__main__":
assets.register(YAMLLoader(os.path.join(DIR,"assets.yml")).load_bundles())
if os.environ.get("DEBUG_FLASK"):
app.run()
else:
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
assets.yml:
style_css:
filters: less
output: css/style.css
contents:
- css/style.less
Run Code Online (Sandbox Code Playgroud)
事实证明,uwsgi 使用 app 变量做自己的事情来运行 webapp,并且不将脚本作为 __main__ 运行,所以
assets.register(YAMLLoader(os.path.join(DIR,"assets.yml")).load_bundles())
Run Code Online (Sandbox Code Playgroud)
从来没有被叫过。我把它移出了
if __name__ == "__main__":
Run Code Online (Sandbox Code Playgroud)
堵塞。它奏效了。
| 归档时间: |
|
| 查看次数: |
341 次 |
| 最近记录: |