Unknown command: 'collectstatic' Django 1.7
Question: I want do static files. I use Django 1.7 and Python 2.7.5 and openshift
hosting. When I try to run:

`python manage.py collectstatic`

I get:

    
    
    Unknown command: 'collectstatic' Type 'manage.py help' for usage.
    

In my settings.py:

    
    
    ... 
    INSTALLED_APPS = (
       'django.contrib.staticfiles',
    
       'django.contrib.admin',
    
       'django.contrib.auth',
    
       'django.contrib.contenttypes',
    
       'django.contrib.sessions',
    
       'django.contrib.messages',
    
       'testapp',
    
    )
    
    TEMPLATE_CONTEXT_PROCESSORS = (
       'django.core.context_processors.static',
    
    )
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': os.environ['OPENSHIFT_APP_NAME'],
            'USER': os.environ['OPENSHIFT_MYSQL_DB_USERNAME'], 
            'PASSWORD': os.environ['OPENSHIFT_MYSQL_DB_PASSWORD'],
            'HOST': os.environ['OPENSHIFT_MYSQL_DB_HOST'],
            'PORT': os.environ['OPENSHIFT_MYSQL_DB_PORT'],
        }
    }
    STATIC_ROOT = ''    
    STATIC_URL = '/static/'
    ...
    

Many people had this proble. They forgot 'django.contrib.staticfiles' in
INSTALLED_APPS. But I have this setting.

Ok, I run help:

    
    
    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
     --no-color            Don't colorize the command output.
     --version             show program's version number and exit
     -h, --help            show this help message and exit
    
     Traceback (most recent call last):
     ...
     File "c:\Python27\lib\os.py", line 423, in __getitem__
       return self.data[key.upper()]
     KeyError: 'OPENSHIFT_APP_NAME'
    

OPENSHIFT_APP_NAME - environment variable (link:
<https://www.openshift.com/page/openshift-environment-variables>) Can you help
me?


Answer: It looks like it can't find the environment variable `OPENSHIFT_APP_NAME`. You
should try setting it and see if that fixes the problem. Django can't import
your settings because it can't find that environment variable.

Those environment variables look like they are set by openshift. You are
probably running that collectstatic command in a shell that has not had them
set. You'll either need to set them in the shell or edit your settings.py to
be able to handle this situation. Something like this would work:

    
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': os.environ.get('OPENSHIFT_APP_NAME', 'A sensible default'),
    

