2013-06-27 34 views
7

Tôi đã cài đặt django trong virtualenv của tôi như thế này:lệnh collectstatic không có sẵn trong Django 1.6a1

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

trong cài đặt của tôi tập tin có điều này:

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', 
) 

Khi tôi cố gắng làm

python manage.py collectstatic 

Tôi nhận được lỗi này:

Unknown command: 'collectstatic' 

Nếu tôi làm

python manage.py --version 

tôi nhận được

1.6a1 

Tại sao không phải là collectstatic sẵn?

Edit:

Khi tôi chạy

python manage.py --help 

tôi có được điều này:

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 
+1

Bạn kích hoạt env ảo của bạn? Theo ghi chú phát hành hiện tại cho _beta_ 1.6a1 thu thập tĩnh nên vẫn có sẵn. –

+0

có, chạy các lệnh này từ bên trong virtualenv được kích hoạt của tôi. –

+0

kiểm tra 'python manage.py --help' và xem nó có được liệt kê không. Ngoài ra hãy thử 'django-admin.py collectstatic'. –

Trả lời

8

Có thể là Django đang tải tập tin cài đặt sai. Xem câu hỏi này để biết chi tiết: Django: Can't run custom commands

Thử tăng ngoại lệ ở đầu tệp settings.py của bạn; sẽ cho bạn biết liệu tệp có đang được tải hay không.

+1

Vâng, đó là nó! Sửa lỗi bằng: 'export DJANGO_SETTINGS_MODULE = myproject.settings.staging' –

+0

Câu trả lời hay ... Vấn đề này đã vấp phải một thời gian cho đến khi bài đăng này ... Cảm ơn. – nicorellius

-1

Add 'STATIC_ROOT'

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

và thử

python manage.py collectstatic 
Các vấn đề liên quan