3
Traceback (most recent call last):
  File "manage.py", line 2, in <module>
    from django.core.management import execute_manager
ImportError: cannot import name execute_manager

I downloaded a django blog project from github and i want to see if work, then i got this, what's it means?

I have checked the manage.py ,here is the code:

#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
    imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
    import sys
    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
    sys.exit(1)

import settings

if __name__ == "__main__":
    execute_manager(settings)

some kind of difference from defaults. So if do i have not enough authority to import execute_manager which may not exist?

what should i do?

4

1 回答 1

2

Sounds like you are using Django 1.6 or newer where execute_manager() was deprecated and removed:

The functions setup_environ() and execute_manager() will be removed from django.core.management. This also means that the old (pre-1.4) style of manage.py file will no longer work.

This django blog project you are using is probably not actively maintained and doesn't support 1.6.

Use execute_from_command_line() instead:

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)

Also see this manage.py template for Django 1.6 from the django sources.

于 2014-05-17T03:01:18.007 回答