How do I use Django South when my app is inside an

2019-09-01 10:04发布

So by default, Django creates apps inside the root project dir. But I moved it inside "apps".

py manage.py  schemamigration ./apps/chat --initial

This doesn't work.

Instead of "chat", I put "chat" Inside another directory.

1条回答
贪生不怕死
2楼-- · 2019-09-01 11:06

is apps python module or just directory?

if apps python modue, add apps.chat to installed apps in settings.py

and run

py manage.py  schemamigration chat --initial

if apps is just directory, so you need to add this directory to your PYTHONPATH. add these lines at near top of your manage.py

import os
import sys
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
APPS_ROOT = os.path.join(SITE_ROOT, 'apps')
sys.path.append(APPS_ROOT)

add chat to your settings.

now run

py manage.py  schemamigration chat --initial

and don't forget to add south to installed apps for both.

查看更多
登录 后发表回答