Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django admin.py Unknown command: 'collectstatic'

Tags:

I have upgraded from django 1.2.7 to django 1.5.1
I am using python 2.6.6
When i try to run python manage.py collectstatic i get

Unknown command: 'collectstatic'

from my settings.py

 STATICFILES_FINDERS = (      'django.contrib.staticfiles.finders.FileSystemFinder',      'django.contrib.staticfiles.finders.AppDirectoriesFinder',      'compressor.finders.CompressorFinder', )   INSTALLED_APPS = (     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'django.contrib.messages',     'django.contrib.admin',     'django.contrib.admindocs',     'django.contrib.staticfiles',  TEMPLATE_CONTEXT_PROCESSORS = (     "django.contrib.auth.context_processors.auth",     "django.core.context_processors.debug",     "django.core.context_processors.i18n",     "django.core.context_processors.media",     "django.core.context_processors.request",     "django.contrib.messages.context_processors.messages",     "MYPROJECT.control.context_processors.debug",     "django.core.context_processors.static", ) 

If i run python manage.py help i get

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

If i run python manage.py version

1.5.1

like image 395
yossi Avatar asked Jul 23 '13 08:07

yossi


People also ask

What is Collectstatic command in Django?

collectstatic. django-admin collectstatic. Collects the static files into STATIC_ROOT . Duplicate file names are by default resolved in a similar way to how template resolution works: the file that is first found in one of the specified locations will be used.


1 Answers

I had a similar error message, but despite my suspicions, it had nothing to do with the Django update. If you have an error in settings (I had an empty SECRET_KEY value), then "django" will be the only app that gets loaded. I found the root of the problem by running python manage.py shell and that quickly told me what's wrong with the settings.

like image 108
jbasko Avatar answered Sep 20 '22 00:09

jbasko