问题
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:
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.
来源:https://stackoverflow.com/questions/5784803/how-do-i-use-django-south-when-my-app-is-inside-another-directory