gpt4 book ai didi

python - 如何在 flask 上提供 clojurescript

转载 作者:太空宇宙 更新时间:2023-11-04 08:55:13 25 4
gpt4 key购买 nike

我有一个小型 Flask 应用程序,我想使用一些 ClojureScript 来增强客户端的用户体验。

现在我无法通过 Flask 提供 clojurescript,因为路径混淆了。

Flask 断言像 Javascript 脚本这样的静态文件位于目录 static 中。我已经更改了我的 project.clj,以便将编译目标放在那里:

                     :output-to  "static/plot.js"
:output-dir "static"

不幸的是,当加载这个文件时,它无法加载带有goog.require的依赖文件:

"ClojureScript could not load :main, did you forget to specify :asset-path?"

我相信路径中缺少的是前导 /static 而不是 static

我可以为那些 inlcudes 指定带有 leiningen cljsbuild 或 clojurescript 的前缀吗?

最佳答案

您需要在编译选项中指定 :asset-path(如错误消息所示)。来自 https://github.com/clojure/clojurescript/wiki/Compiler-Options#asset-path

When using :main it is often necessary to control where the entry point script attempts to load scripts from due to the configuration of the web server. :asset-path is a relative URL path not a file system path.

   :asset-path "assets/js"

关于python - 如何在 flask 上提供 clojurescript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30818130/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com