Satchmo clonesatchmo.py ImportError: cannot import

2019-06-15 15:57发布

I get satchmo to try, but I have a great problem at first try, and I don't understand whats wrong. When I making $ python clonesatchmo.py into clear django project, it trows an error:

$ 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.

AND creates a store folder. trying smth like this is working!!:

$ 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"

I have Django 1.6 and Satchmo 0.9.3, python 2.7.5 (I do not use virtualenv)

2条回答
做自己的国王
2楼-- · 2019-06-15 16:31

execute_manager was put on the deprecation path as part of the project layout refactor in Django 1.4 https://docs.djangoproject.com/en/1.4/releases/1.4/#django-core-management-execute-manager. Per the deprecation policy that means that the code for execute_manager has been completely removed in 1.6. If you are seeing this import error then the version of Satchmo you are using has not been updated to be compatible with Django 1.6.

查看更多
一纸荒年 Trace。
3楼-- · 2019-06-15 16:52

Replace the contents of manage.py with the following (from a new django 1.6 project).

#!/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)
查看更多
登录 后发表回答