简体   繁体   English

当我的应用位于另一个目录中时,如何使用Django South?

[英]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.

相关问题 Django South - 如何在Django应用程序上重置迁移历史记录并开始清理 - Django South - How do I reset migration history and start clean on Django app Django:如何构建应用程序以使用许多数据库 - Django: how do I structure my app to use many databases 如何在数据库服务器上运行向南迁移(Django)? - How do I run South migrations (Django) on a database server? 如何从 django 项目中删除南 - How do I remove south from a django project Django-南迁移-如何将大型迁移分解为几个较小的迁移? 如何使南方变得更聪明? - Django - South migration - how do I break a large migration down into several smaller migrations? How can I make South smarter? 如何让South在Heroku中为Django应用程序工作 - How to make South works in Heroku for a Django app 如何正确使用此Django应用程序? - How do I use this Django app correctly? django - 我如何使用来自 select 表单的输入来比较我的数据库中的数据和 output 在另一个页面上的数据? - django - how do i use an input from a select form to compare data in my database and output it on another page? 在进行South数据迁移时,如何访问Django模型的mixin方法? - How do you access mixin methods for Django models when doing a South datamigration? 当我运行服务器时,如何让我的 Django 应用程序*做*一些事情? - How can I make my Django App *do* something when I run the server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM