Django loaddata settings error
Question: When trying to use loaddata on my local machine (win/sqlite):

    
    
    python django-admin.py loaddata dumpdata.json
    

I get the following error:

    
    
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
    

I am using djangoconfig app if that helps:

    
    
    """
    Django-config settings loader.
    """
    
    import os
    
    CONFIG_IDENTIFIER = os.getenv("CONFIG_IDENTIFIER")
    if CONFIG_IDENTIFIER is None:
        CONFIG_IDENTIFIER = 'local'
    
    # Import defaults
    from config.base import *
    
    # Import overrides
    overrides = __import__(
        "config." + CONFIG_IDENTIFIER,
        globals(),
        locals(),
        ["config"]
    )
    
    for attribute in dir(overrides):
        if attribute.isupper():
            globals()[attribute] = getattr(overrides, attribute)
    

**projects>python manage.py loaddata dumpdata.json --settings=config.base**

    
    
    WARNING: Forced to run environment with LOCAL configuration.
    
    Problem installing fixture 'dumpdata.json': Traceback
     (most recent call last):
      File "loaddata.py", line 174, in handle
        obj.save(using=using)
    
    ...
    
    
      File "C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py", line
    234, in execute
        return Database.Cursor.execute(self, query, params)
    IntegrityError: columns app_label, model are not unique
    


Answer: Don't use `django-admin.py` for anything other than setting up an initial
project. Once you have a project, use `manage.py` instead - it sets up the
reference to your settings file.

