我在我已安装南的virtualenvwrapper
实例中安装了Django。然而
调用python manage.py syncdb
时,virtualenvwrapper
之外的Django安装被调用,但找不到south
。我该如何解决这个问题?
[~/devground/django_gilgamesh]# pip install south
Downloading/unpacking south
Downloading South-0.8.4-py2.py3-none-any.whl (135kB): 135kB downloaded
Installing collected packages: south
Successfully installed south
Cleaning up...
(django_gilgamesh)sdye@dy-borg.com [~/devground/django_gilgamesh]# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/sdye/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/sdye/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sdye/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/sdye/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/home/sdye/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/home/sdye/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/home/sdye/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/sdye/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home/sdye/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named south
编辑:我已经尝试了南方的&#39;和南方&#39;在settings.py中。 settings.py文件如下所示。
编辑:使用&#39; south&#39;生成的新追踪替换了追溯。在settings.py中重新安装南
EDIT2:which django-admin.py
/home/sdye/.virtualenvs/django_gilgamesh/bin/django-admin.py 的输出
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'p3)1ravw(zzt25-$tj0fd@r8^i1(0b1==tuk5e3ph32k8yjs20'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'django_gilgamesh.urls'
WSGI_APPLICATION = 'django_gilgamesh.wsgi.application'
更新:在命令行import south
上进行测试时会产生ImportError:没有名为south的模块
答案 0 :(得分:1)
解决:看起来python在virtualenvwrapper实例之外寻找南方。当我在关闭virtualenv之后安装南部时,迁移工作。这会产生另一个我将在新线程中发布的问题。
注意:因为我在virtualenvwrapper实例中使用了django,所以不应该这样做
任何人都有一个想法如何解决这个或更好的解释为什么会发生这种情况?