這可能是一個簡單的問題,但我確實在這個問題上停滯不前。django使用變量從不同文件中獲取變量的方法
我一直在試圖教自己如何使view.py文件中的方法在其他文件中可用。
我有一個views.py文件,其中有幾種方法,像這樣:
def get_available_language_details(language_versions, user_language_code):
.......
def language_versions_compare(x, y):
.......
def get_language_versions(user):
......
在我education.py文件,我知道我必須從views.py文件import語句,但我不知道怎麼寫import語句的語法以及語法來調用上述方法在education.py文件:
import appname.core.views import ??
編輯
這裏是我的目錄海峽ucture:
appname
__init__.py
core
__init__.py
views.py
views
__init__.py
education.py
這些功能,而不是方法不對? – utkbansal