从 django 1.2.7 升级到 1.5.1 后尝试使用运行 celery
python manage.py celeryd -v 2 -l INFO --settings=settings
我有一个错误说
django.core.management.execute_manager
在 django 1.4 中已弃用
我的管理.py
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import 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(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_from_command_line(settings)
我查看了 django 1.4 发行说明
django-core-management-execute-manager
正如它所说,我用 execute_from_command_line 替换了 execute_manager
现在我在重新启动服务器时开始收到此错误消息
Traceback (most recent call last):
File "C:\my\manage.py", line 12, in <module>
execute_from_command_line(settings)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 452, in execute_from_command_line
utility = ManagementUtility(argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 226, in __init__
self.prog_name = os.path.basename(self.argv[0])
TypeError: 'module' object is not subscriptable