我有Django模型Driver
和Trip
。我的视图中没有任何内容,也没有URL。我使用Django作为数据库,使用脚本在数据库中存储内容。你知道吗
这是我的每一件事物的样子:
loadmngr/
models.py
views.py
urls.py
management/
commands/
> it.py <
假设在management
和commands
中有init.py。你知道吗
我所做的只是简单地导入我的Django模型。这里是it.py
:
import sys
parent = '/Users/work/TM/loadmngr'
sys.path.insert(0, parent)
from models import Trip
我运行python manage.py it
,得到一个RunTimeError
:
RunTimeError: Model class models.Driver doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded.
错误的后半部分...or else was imported before its application was loaded
是我认为可能的问题所在。你知道吗
问题是:如何在正确配置设置的情况下在外部正确使用Django模型?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐