由于存放图片是放在远程服务器上的,服务器的域名是放在配置文件里的,方便以后迁移。
在Flask中,用app.config.from_envvar(<filename>)载入我的配置,通常情况下,都是写入视图函数让模板进行调用,如果每个视图函数都写入,维护起来不方便。那么,有没有办法不通过这个方法实现呢?
app.config.from_envvar(<filename>)
欢迎选择我的课程,让我们一起见证您的进步~~
#settings.py SOME_VARIABLE = 10
#app.py app.config.from_object("app.settings")
# template.html {{ config.SOME_VARIABLE }}
I don’t understand your question.
If you call static files through the system, you can configure the static url.
If you need to register global variables, you can see context_processor.
You can consider registering a filter for the template.
I don’t understand your question.
If you call static files through the system, you can configure the static url.
If you need to register global variables, you can see context_processor.
You can consider registering a filter for the template.