2011-09-07 43 views
1

我一直在嘗試使用PostrgeSQL與我的Django的應用程序,但我才把下面的錯誤(在項目開始後,權當我只有以下文件:__init__.pymanage.pysettings.pycurls.pyc__init__.pycsettings.pyurls.py)和我已經添加後的型號:Django和PostgreSQL的「沒有找到燈具」

python manage.py syncdb 
Creating tables ... 
Installing custom SQL ... 
Installing indexes ... 
No fixtures found. 

我甚至不試圖加載裝置。 Psycopg2已安裝。這是我的settings.py的數據庫部分

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.postgresql_psycopg2', 
     # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': 'myapp_development',      
     # Or path to database file if using sqlite3. 
     'USER': 'foo',      # Not used with sqlite3. 
     'PASSWORD': 'password',     # Not used with sqlite3. 
     'HOST': '',  
     # Set to empty string for localhost. Not used with sqlite3. 
     'PORT': '',      
     # Set to empty string for default. Not used with sqlite3. 
    } 
} 
+2

http://stackoverflow.com/questions/3328708/why-im-getting-no-fixtures-found-when-i-run-python-manage-py-syncdb-command ...我想這個這不是一個錯誤,它只是告訴你沒有固定裝置。 –

回答

4

這意味着Django沒有找到任何裝置。如果沒有燈具,這是一個標準信息。

夾具是下一個格式的文件(使用現有的模型來創建數據庫中的實際對象):

[ 
    { 
    "model": "myapp.person", 
    "pk": 1, 
    "fields": { 
     "first_name": "John", 
     "last_name": "Lennon" 
    } 
    }, 
    { 
    "model": "myapp.person", 
    "pk": 2, 
    "fields": { 
     "first_name": "Paul", 
     "last_name": "McCartney" 
    } 
    } 
] 

查看更多詳細信息:http://docs.djangoproject.com/en/dev/howto/initial-data/

2

你設置你的settings.pyFIXTURE_DIRS設定值?

請參閱here以獲取文檔。

1

當您運行

manage.py syncdb

django嘗試爲您的項目中的應用程序加載初始數據。 。 默認情況下,從APP-DIR \燈具加載數據\ initial_data [XML/YAML/JSON]文件 所以,當文件不存在,你看:

無夾具發現

精益更多的Django official page