如何创建应用程序范围变量django? [英] How do I create application scope variable django?
本文介绍了如何创建应用程序范围变量django?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建一个在django应用程序启动时加载的应用程序范围变量,可以在内存中被所有人访问。
How can I create an application scope variable which is loaded when the django app starts, be in memory and accessible by all.
基本上我想重用变量
谢谢
推荐答案
你可以将其添加到您的 settings.py
文件中。或者将其添加到应用程序目录中的 __ init __。py
文件。
You could add it to your settings.py
file. Or, add it to the __init__.py
file inside the app directory.
这篇关于如何创建应用程序范围变量django?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文