Reputation: 15
Good evening, I am facing a weird problem with my django project. From my Ubuntu, where I started to develop it, I didn't find any issue around it, but when I tried to move it in my OS X El Capitan, then I'm either receiving one of this error:
1) When APP_DIRS
is set to True
: app_dirs
must not be set when loaders is defined.
2) When APP_DIRS
is set to False
or removed: No module named 'admin_tools.template_loaders'
Is there anything that I'm doing bad in this settings.py?
That's how my settings.py looks like:
SITE_ID = 1
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'tinymce',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'management',
'myApp',
'easy_thumbnails',
)
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace",
'theme': "advanced",
'cleanup_on_startup': True,
'custom_undp_redo_levels': 10,
}
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'myproject.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'django.template.context_processors',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]),
'admin_tools.template_loaders.Loader',
]
},
},
]
WSGI_APPLICATION = 'myproject.wsgi.application'
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
AUTH_USER_MODEL = 'management.IfasicUser'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
)
LOGIN_URL = 'django.contrib.auth.views.login'
LOGIN_REDIRECT_URL = 'home'
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
CRISPY_TEMPLATE_PACK = 'bootstrap3'
Any help will be gladly appreciated.
Upvotes: 1
Views: 1498
Reputation: 308779
When
App_DIRS
is set toTrue
:app_dirs
must not be set when loaders is defined.
As the error says, you must remove the app_dirs
setting when you define loaders
.
When
APP_DIRS
is set toFalse
or removed: No module named 'admin_tools.template_loaders'
Try upgrading to 0.7.1, which was released today. Looking at the changelog, there appears to be a bug with the cached template loader.
Upvotes: 1