Satchmo clonesatchmo.py ImportError: cannot import name execute_manager

故事扮演 提交于 2019-12-08 15:35:15

问题


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)


回答1:


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.




回答2:


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)


来源:https://stackoverflow.com/questions/18048232/satchmo-clonesatchmo-py-importerror-cannot-import-name-execute-manager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!