2013-06-27 17 views
7

ho installato nel mio Django virtualenv come questo:comando collectstatic non è disponibile in Django 1.6a1

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

nelle mie impostazioni file di avere questo:

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

Quando provo a fare

python manage.py collectstatic 

ottengo questo errore:

Unknown command: 'collectstatic' 

Se faccio

python manage.py --version 

ottengo

1.6a1 

Perché non è collectstatic disponibili?

Edit:

Quando eseguo

python manage.py --help 

ottengo questo:

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

Hai attivare il tuo env virtuale? Secondo le attuali note di rilascio per _beta_ 1.6a1 raccogliere statico dovrebbe essere ancora disponibile. –

+0

sì, eseguendo questi comandi dall'interno del mio virtualenv attivato. –

+0

controlla 'python manage.py --help' e controlla se è elencato. Prova anche a 'django-admin.py collectstatic'. –

risposta

8

E 'possibile che Django sta caricando il file di impostazioni errate. Vedere questa domanda per i dettagli: Django: Can't run custom commands

Provare a generare un'eccezione nella parte superiore del file settings.py; che ti consente di sapere se il file è ancora in fase di caricamento.

+1

Sì, era così! Risolto il problema con: 'export DJANGO_SETTINGS_MODULE = myproject.settings.staging' –

+0

Ottima risposta ... Questo problema mi ha fatto incavolare per un po 'di tempo fino a questo post ... Grazie. – nicorellius

-1

Add 'STATIC_ROOT'

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

e cercare

python manage.py collectstatic 
Problemi correlati