Django 1.6a1中没有collectstatic命令

时间:2013-06-27 08:49:37

标签: django

我已经在我的virtualenv中安装了django:

git clone git://github.com/django/django.git django-trunk
pip install -e django-trunk/

在我的设置文件中有这个:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.admindocs',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'south',
    'djcelery',
    'gunicorn',
    'sorl.thumbnail',
    'template_utils',
    'compressor',
    'tagging',
    'ckeditor',
    'mptt',
)


STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

当我尝试

python manage.py collectstatic

我收到此错误:

Unknown command: 'collectstatic'

如果我这样做

python manage.py --version

我得到了

1.6a1

为什么不提供收集活动?

编辑:

当我跑步时

python manage.py --help

我明白了:

Usage: manage.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on exception
  --version             show program's version number and exit
  -h, --help            show this help message and exit

Type 'manage.py help <subcommand>' for help on a specific subcommand.

Available subcommands:

[django]
    check
    cleanup
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    runfcgi
    runserver
    shell
    sql
    sqlall
    sqlclear
    sqlcustom
    sqldropindexes
    sqlflush
    sqlindexes
    sqlinitialdata
    sqlsequencereset
    startapp
    startproject
    syncdb
    test
    testserver
    validate

2 个答案:

答案 0 :(得分:8)

Django可能正在加载错误的设置文件。有关详细信息,请参阅此问题:Django: Can't run custom commands

尝试在settings.py文件的顶部引发异常;这将让你知道文件是否被加载。

答案 1 :(得分:-1)

添加&#39; STATIC_ROOT&#39;

STATIC_ROOT = "/var/www/example.com/static/"

并尝试

python manage.py collectstatic