以下是我的设置
FIXTURE_DIRS = (
os.path.join(BASE_DIR, "fixtures",)
)
$ python manage.py diffsettings | grep fixtures
FIXTURE_DIRS = '/home/user/project/src/fixtures'
运行syncdb时有什么奇怪的,我得到以下内容。
它以递归方式加载FIXTURE_DIRS
中设置的灯具路径中的每个字符。
它找不到任何目录,因为它们不存在。
$ python manage.py syncdb -v3
project.settings
project/src
Running pre-sync handlers for application admin
Running pre-sync handlers for application auth
Running pre-sync handlers for application contenttypes
Running pre-sync handlers for application sessions
Running pre-sync handlers for application messages
Running pre-sync handlers for application staticfiles
Running pre-sync handlers for application admindocs
Running pre-sync handlers for application webdesign
Running pre-sync handlers for application helloworld
Creating tables ...
Running post-sync handlers for application admin
Running post-sync handlers for application auth
Running post-sync handlers for application contenttypes
Running post-sync handlers for application sessions
Running post-sync handlers for application messages
Running post-sync handlers for application staticfiles
Running post-sync handlers for application admindocs
Running post-sync handlers for application webdesign
Running post-sync handlers for application helloworld
Installing custom SQL ...
Installing indexes ...
Checking '/' for fixtures...
No fixture 'initial_data' in '/'.
Checking 'project/src/h' for fixtures...
No fixture 'initial_data' in 'project/src/h'.
Checking 'project/src/o' for fixtures...
No fixture 'initial_data' in 'project/src/o'.
Checking 'project/src/m' for fixtures...
No fixture 'initial_data' in 'project/src/m'.
Checking 'project/src/e' for fixtures...
No fixture 'initial_data' in 'project/src/e'.
Checking '/' for fixtures...
No fixture 'initial_data' in '/'.
Checking 'project/src/u' for fixtures...
No fixture 'initial_data' in 'project/src/u'.
Checking 'project/src/s' for fixtures...
No fixture 'initial_data' in 'project/src/s'.
Checking 'project/src/e' for fixtures...
No fixture 'initial_data' in 'project/src/e'.
Checking 'project/src/r' for fixtures...
No fixture 'initial_data' in 'project/src/r'.
Checking '/' for fixtures...
No fixture 'initial_data' in '/'.
Checking 'project/src/p' for fixtures...
No fixture 'initial_data' in 'project/src/p'.
Checking 'project/src/r' for fixtures...
No fixture 'initial_data' in 'project/src/r'.
Checking 'project/src/o' for fixtures...
No fixture 'initial_data' in 'project/src/o'.
Checking 'project/src/j' for fixtures...
No fixture 'initial_data' in 'project/src/j'.
Checking 'project/src/e' for fixtures...
No fixture 'initial_data' in 'project/src/e'.
Checking 'project/src/c' for fixtures...
No fixture 'initial_data' in 'project/src/c'.
Checking 'project/src/t' for fixtures...
No fixture 'initial_data' in 'project/src/t'.
Checking '/' for fixtures...
No fixture 'initial_data' in '/'.
Checking 'project/src/s' for fixtures...
No fixture 'initial_data' in 'project/src/s'.
Checking 'project/src/r' for fixtures...
No fixture 'initial_data' in 'project/src/r'.
Checking 'project/src/c' for fixtures...
No fixture 'initial_data' in 'project/src/c'.
Checking '/' for fixtures...
No fixture 'initial_data' in '/'.
Checking 'project/src/f' for fixtures...
No fixture 'initial_data' in 'project/src/f'.
Checking 'project/src/i' for fixtures...
No fixture 'initial_data' in 'project/src/i'.
Checking 'project/src/x' for fixtures...
No fixture 'initial_data' in 'project/src/x'.
Checking 'project/src/t' for fixtures...
No fixture 'initial_data' in 'project/src/t'.
Checking 'project/src/u' for fixtures...
No fixture 'initial_data' in 'project/src/u'.
Checking 'project/src/r' for fixtures...
No fixture 'initial_data' in 'project/src/r'.
Checking 'project/src/e' for fixtures...
No fixture 'initial_data' in 'project/src/e'.
Checking 'project/src/s' for fixtures...
No fixture 'initial_data' in 'project/src/s'.
Checking 'project/src' for fixtures...
No fixture 'initial_data' in 'project/src'.
Installed 0 object(s) from 0 fixture(s)
答案 0 :(得分:3)
此问题已解决,但仔细查看我的设置。
FIXTURE_DIRS = (
os.path.join(BASE_DIR, "fixtures",)
)
应该是
FIXTURE_DIRS = (
os.path.join(BASE_DIR, "fixtures",),
)
如果你看不出有什么不同,我花了几个小时试图解决这个问题。 ,
是唯一的区别。看看os.path.join(BASE_DIR, "fixtures",)
的结尾现在有一个,
。
我预计将来其他人会遇到这个问题。 所以我提供了答案。