I successfully configured django-admin-tools for using. I tried to create a custom menu as told in documentation as below:
python3 manage.py custommenu
However, this raised an ImproperlyConfugured
error below, saying:
django.core.exceptions.ImproperlyConfigured: app_dirs must not be set when loaders is defined.
I looked at the directory, menu.py is successfully created, yet the content is empty in opposition to the documentation.
My confituration of TEMPLATES
variable is below:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'admin_tools.template_loaders.Loader',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'admin_tools.template_loaders.Loader',
],
},
},
]
Does that mean I need to install django-admin-tools
before creating any app?
Remove the 'APP_DIRS': True,
line.
If you wanted to know why you'd need to remove 'APP_DIRS': True,
to make it work then I would suggest you have a read in the docs - https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.app_directories.Loader
Note: Please use the corresponding docs for your django version.
In general:APP_DIRS
and the option loaders
does not work together, so you're left with two options:
loaders
from OPTIONS
APP_DIRS
Re question:
Since Erdin wanted to use 'admin_tools.template_loaders.Loader'
he had to remove APP_DIRS
. However, you might tumble across this question for a different reason and so considering option number 1 might be worthwhile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With