AttributeError:'元组'对象没有属性’' Django的

时间:2014-04-10 01:55:06

标签: python django

我是django的新手,我在运行命令python manage.py collectstatic

后收到此错误
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/management/__init__.py", line 76, in load_command_class
    return module.Command()
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/contrib/staticfiles/management/commands/collectstatic.py", line 58, in __init__
    self.storage.path('')
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/utils/functional.py", line 213, in inner
    self._setup()
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/contrib/staticfiles/storage.py", line 311, in _setup
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/files/storage.py", line 282, in get_storage_class
    return import_by_path(import_path or settings.DEFAULT_FILE_STORAGE)
  File "/Users/bradfordli/Development/django_tutorial/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/utils/module_loading.py", line 16, in import_by_path
    module_path, class_name = dotted_path.rsplit('.', 1)
AttributeError: 'tuple' object has no attribute 'rsplit'

当我runserver这是输出

http://pastebin.com/2bh7h7gY

1 个答案:

答案 0 :(得分:4)

settings.py中的一个设置是一个元组,或者有一个不必要的尾随逗号,它会把它变成一个元组,它不应该是。它应该是一个字符串。

我首先看一下STATICFILES_STORAGEDEFAULT_FILE_STORAGE