0
我試圖按照Django的教程,並創建兩個表,其中表1的唯一密鑰可能出現多次對錶2(具有不同的獨特的鍵)導入錯誤
CREATE TABLE "apples" (
"id1" integer NOT NULL PRIMARY KEY,
"value1" varchar(400) NOT NULL,
)
;
CREATE TABLE "oranges" (
"id2" integer NOT NULL PRIMARY KEY,
"id1" integer NOT NULL REFERENCES "MyApp_apples" ("id"),
"value2" datetime NOT NULL,
)
時試圖運行:
import package
from package import MyApp
from package.MyApp import models
from package.MyApp import apples, oranges
p = apples.objects.get(id=1)
p.oranges_set.create(value2="2168164000000")
我得到的錯誤堆棧(我只後結束,如果你需要更多的,請告訴我):
File "/usr/lib/pymodules/python2.7/django/utils/translation/trans_real.py", line 162, in _fetch
app = import_module(appname)
File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named MyApp
我認爲這是導入問題,但我該如何解決?
你能告訴我們關於涉及的文件/文件夾嗎? –