Admin Site: TemplateDoesNotExist at /admin/

前端 未结 16 1823
鱼传尺愫
鱼传尺愫 2020-12-09 04:00

I\'m following Django\'s official Tutorial 2 but for some reason cannot create an admin site despite following all the steps correctly to my understanding.

This is t

16条回答
  •  遥遥无期
    2020-12-09 04:30

    I ran into similar problem trying to configure django-admin-tools for Django 2.0.2

    Eventually I got it working. Here's my TEMPLATES settings.

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [os.path.join(BASE_DIR, 'templates')],
            'APP_DIRS': False,
            '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',
                ],
                'loaders' : [
                    'django.template.loaders.filesystem.Loader',
                    'django.template.loaders.app_directories.Loader',
                    'admin_tools.template_loaders.Loader',
                    ]
            },
        },
    ]
    

    This worked even as I overrode the default admin template.

    Just be sure to take note of where to place the django-admin-tools apps. See @Abrie Nel's answer above.

提交回复
热议问题