wemake-services / django-split-settings

Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.
http://django-split-settings.rtfd.io
BSD 3-Clause "New" or "Revised" License
1.11k stars 67 forks source link

ImproperlyConfigured at XXX | settings does not seem to load #3

Closed agateblue closed 9 years ago

agateblue commented 10 years ago

Hi,

first of all, thank you for this app, it seems great. However, I can't get it to work !

I followed the docs and informations from this blog entry but on every request, I get the following error :

ImproperlyConfigured at /

Put 'django.contrib.contenttypes' in your INSTALLED_APPS setting in order to use the admin application.

If I remove admin.site.urls from my urls.py, i get this :

ImproperlyConfigured at /

settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

If I understand correctly, my settings are not loaded at all. But :

Here is my folder structure (kii is the name of my project) : kii ├── settings │   ├── components │   │   ├── apps_settings.py │   │   ├── base_settings.py │   │   ├── kii_settings.py │   │   └── locale_settings.py │   ├── dev.py │   ├── init.py

Here is content of init and dev files :

settings/init.py

from split_settings.tools import optional, include
include(
    'components/kii_settings.py',
    'components/base_settings.py',
    'components/apps_settings.py',
    'components/locale_settings.py',
    'dev.py',
    scope=locals()
)

settings/dev.py

import os
print('local_settings loaded')
DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS += (
# ('Your Name', 'your_email@example.com'),
)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'XXXX',                      # Or path to database file if using sqlite3.
        # The following settings are not used with sqlite3:
        'USER': 'root',
        'PASSWORD': 'XXXX',
        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
        'PORT': '',                      # Set to empty string for default.
        'OPTIONS': {
        "init_command": "SET storage_engine=MyISAM",
        } 

        }
        }
ALLOWED_HOSTS=[]
MEDIA_ROOT = os.path.join(PROJECT_PATH, "media")

INSTALLED_APPS += (
    'debug_toolbar',
) 

MIDDLEWARE_CLASSES = (    
    'debug_toolbar.middleware.DebugToolbarMiddleware',
)

DEBUG_TOOLBAR_CONFIG= { "INTERCEPT_REDIRECTS":False}

And finally, the whole error stacktrace :

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.5.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.humanize',
'django.contrib.admindocs',
'menus',
'south',
'sekizai',
'jquery',
'mptt',
'modeltranslation',
'polymorphic',
'django_markdown',
'crispy_forms',
'autocomplete_light',
'django_extensions',
'djcelery',
'kombu.transport.django',
'purl_js',
'jqueryui',
'contextmenu',
'base_items',
'classify',
'library',
'user',
'kii',
'widgets',
'permissions',
'import_export',
'kii_menus',
'search',
'debug_toolbar')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',)

Traceback:
File "/home/eliotberriot/Envs/kii/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
92.                     response = middleware_method(request)
File "/home/eliotberriot/Envs/kii/local/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
35.     __import__(name)
File "/home/eliotberriot/kii/kii/urls.py" in <module>
23.     url(r'^admin/', include(admin.site.urls)),  
File "/home/eliotberriot/Envs/kii/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in urls
257.         return self.get_urls(), self.app_name, self.name
File "/home/eliotberriot/Envs/kii/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in get_urls
215.             self.check_dependencies()
File "/home/eliotberriot/Envs/kii/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in check_dependencies
165.             raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in "

Exception Type: ImproperlyConfigured at /
Exception Value: Put 'django.contrib.contenttypes' in your INSTALLED_APPS setting in order to use the admin application.

Am I missing something obvious ? Thank you for your time and your help, just tell me if you need more informations.

roxeteer commented 9 years ago

Is the file name actually settings/init.py? It should be settings/__init__.py to make it a proper Python package.

(I guess this reply comes a bit late, though :smile:)

agateblue commented 9 years ago

Better late than never ! Honestly, I don't remember the context of this, and my code use a totally different approach for settings management now, so I won't be able to provide additional data :/