Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已将生菜添加到我的 django 项目中,将languages.py文件保存在 django 项目中的哪里而不是修改生菜本身?
languages.py
苏丹
我不知道生菜,但我猜你可以languages.py在 python 可以找到的任何地方包含你的文件。
我通过将包含我的文件的目录附加到sys.path. 您可以改写 PYTHONPATH。包含 python 代码的目录应该有一个__init__.py文件。
sys.path
__init__.py
我不确定您是否已经尝试过上述方法。如果你这样做了,你可以忽略我的回答。