Django: models aren't being recognized by syncDB or south after they have been refactored into separate files

百般思念 提交于 2019-12-03 14:38:22

To expose classes you have to import them in the __init__.py, like:

from Picture import Picture 
from paperType import paperType 
...
__all__ = ['Picture', 'paperType', ...]

The order of importing is important.

If you don't do this, you have no access path picviewer.models.Picture, it's picviewer.models.Picture.Picture.

JackLeo

That might be missing app_label: http://docs.djangoproject.com/en/dev/ref/models/options/#app-label. More also in syncdb ignores imported models it covers most of it. If what please add more details so that answer could be updated.

UPDATE: http://www.djangopro.com/2011/01/django-database-migration-tool-south-explained/ seems that models might be OK. Migrations might be the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!