[英]How do I use Django South when my app is inside another directory?
So by default, Django creates apps inside the root project dir. 因此,默认情况下,Django在根项目目录中创建应用。 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. 我将“聊天”放在另一个目录中,而不是“聊天”。
is apps python module or just directory? 是应用python模块还是目录?
if apps python modue, add apps.chat to installed apps in settings.py 如果应用程式为python模式,请将apps.chat新增至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. 如果apps仅是目录,那么您需要将此目录添加到PYTHONPATH中。 add these lines at near top of your manage.py 在您的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. 并且不要忘记为这两个都向已安装的应用程序添加内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.