Aptana 中的 Django South 问题
我尝试将 South
迁移工具添加到我的 Django 应用程序中。我通过运行 python setup.py install
安装了 South
并且安装成功。现在我可以运行 migrate appname
和 schemamigration appname --auto
命令,它们工作得很好。
但是,在我运行 migration appname
后,它在我的应用程序文件夹下创建了 migration
包,并创建了 init.py
。这个 init
文件中有这样的导入
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
虽然一切都很完美,但是 from Southern.db
和 from South.v2
行在 Aptana 中给出了错误,即关于它无法导入这些文件。
你知道为什么会发生这种情况吗?我应该将 South 文件夹的位置添加到任何系统路径吗?
谢谢
I try to add South
migration tool to my Django app. I installed South
by running python setup.py install
and it is installed successfully. Now I can run migrate appname
and schemamigration appname --auto
commands and they work great.
However, after I run migration appname
, it created migration
package under my app folder and created a init.py
. There are such imports in this init
file
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
Although everything works perfect, from south.db
and from south.v2
lines give error in Aptana which is about it cannot import these files.
Do you have any idea why it happens ? Should I add the location of south folder to any system path ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否已将安装 Southern 的父目录(site-pacakges,或者可能是 virtualenv 的 site-packages)文件夹添加到项目的 pythonpath 中?
您需要将项目设置为 PyDev 项目或 Django 项目。
右键单击您的项目,选择正确的性质。
然后再次右键单击并转到“属性”。
选择 PyDev-PYTHONPATH 设置并单击外部库。
单击“添加源文件夹”,导航到要添加到路径的模块的父级,然后单击“应用”或“确定”,具体取决于要添加到项目的 pythonpath 的文件夹数量。
希望对您有所帮助。
Have you added the parent directory where south was installed (site-pacakges, or maybe a virtualenv's site-packages) folder to your Project's pythonpath?
You'll need to set your project as either a PyDev project or Django project.
Right-click on your project, choose the correct nature.
Then right-click again and go to Properties.
Choose the PyDev-PYTHONPATH setting and click on External Libraries.
Click Add source folder, nav to the parent of the module you want to add to the path and hit either apply or OK, depending on how many folders you want to add to the project's pythonpath.
Hope that helps you out.