Satchmo clonesatchmo.py importorror:无法导入名称execute\u manag

2024-05-23 15:25:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我让萨奇莫试一试,但我在第一次试一试时遇到了一个很大的问题,我不明白是什么错了。 当我将$ python clonesatchmo.py放入clear django项目时,它会显示一个错误:

$ python clonesatchmo.py
Creating the Satchmo Application
Customizing the files
Performing initial data synching
Traceback (most recent call last):
  File "manage.py", line 18, in <module>
    from django.core.management import execute_manager
ImportError: cannot import name execute_manager
Traceback (most recent call last):
File "manage.py", line 18, in <module>
  from django.core.management import execute_manager
ImportError: cannot import name execute_manager
Error: Can not copy the static files.
Error: Can not syncdb.

并创建存储文件夹。 像这样尝试smth是有效的!!以下内容:

$ python manage.py shell
>>> import os, sys
>>> print sys.executable
/some/path/to/python
>>> os.system('bash')
$ /some/path/to/python manage.py validate
# this is NOT fail on "from django.core.management import execute_manager"

我有Django 1.6和Satchmo 0.9.3,python 2.7.5 (我不使用virtualenv)


Tags: thedjangofrompycoreimportmostexecute
2条回答

将manage.py的内容替换为以下内容(来自新的django 1.6项目)。

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<app>.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

作为Django 1.4https://docs.djangoproject.com/en/1.4/releases/1.4/#django-core-management-execute-manager中项目布局重构的一部分,execute_manager被置于弃用路径上。这意味着execute_manager的代码已在1.6中完全删除。如果您看到这个导入错误,那么您使用的Satchmo版本尚未更新为与Django 1.6兼容。

相关问题 更多 >