gpt4 book ai didi

python - 名称错误 : name 'static_url' is not defined

转载 作者:行者123 更新时间:2023-12-01 03:51:01 24 4
gpt4 key购买 nike

我正在尝试升级 django-summernote到我的 django 1.9 项目中的版本 0.8.5,但是使用给定的设置,我收到此错误:

 File "my_project/settings/base.py", line 314, in <module>
static_url('django_summernote/summernote.css'),
NameError: name 'static_url' is not defined

我以前没有见过 static_url(),它来自哪里以及如何让它工作?

最佳答案

尝试查看源代码。您将看到函数 static_url 是在 django_summernote.settings 中定义的。

因此,要在设置模块中使用它,您需要导入它,或者自己将其定义为:

def static_url(url):
return os.path.join(STATIC_URL, url)

关于python - 名称错误 : name 'static_url' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38256235/

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