Overriding Admin Template

I am new to django, I am following the user guide to modify admin template, however, got the following error when I put ‘DIRS’: [BASE_DIR / ‘templates’], in my settings.py:

my tree is like this:
├── db.sqlite3
├── manage.py
├── mysite
│ ├── asgi.py
│ ├── init.py
│ ├── pycache
│ │ ├── init.cpython-37.pyc
│ │ ├── settings.cpython-37.pyc
│ │ ├── urls.cpython-37.pyc
│ │ └── wsgi.cpython-37.pyc
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── polls
│ ├── admin.py
│ ├── apps.py
│ ├── init.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── init.py
│ │ └── pycache
│ │ ├── 0001_initial.cpython-37.pyc
│ │ └── init.cpython-37.pyc
│ ├── models.py
│ ├── pycache
│ │ ├── admin.cpython-37.pyc
│ │ ├── apps.cpython-37.pyc
│ │ ├── init.cpython-37.pyc
│ │ ├── models.cpython-37.pyc
│ │ ├── tests.cpython-37.pyc
│ │ ├── urls.cpython-37.pyc
│ │ └── views.cpython-37.pyc
│ ├── static
│ │ └── polls
│ │ ├── images
│ │ │ └── bgimage.jpg
│ │ └── style.css
│ ├── templates
│ │ └── polls
│ │ ├── detail.html
│ │ ├── index.html
│ │ └── results.html
│ ├── tests.py
│ ├── urls.py
│ └── views.py
└── templates
└── admin
└── base_site.html

I also changed base_site.html to:

My administration

but it doesn't work, not even able to runserver

What user guide are you following? (If it’s part of the regular Django documentation, then there might be a typo that needs to be fixed.)

What the intent of that statement is to concatenate two strings, base_dir and ‘/templates’. So that line should look something more like this:

'DIRS': [BASE_DIR + '/templates'],

Ken

Ah, thanks, that worked. I use this guide:
image

What page (url)? I’m not finding it on the web site.

This is due to the change in 3.1 to use pathlib for BASE_DIR in new projects. See my blog post: https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/

3.1 is not released yet, so using its documentation is a bit premature :slight_smile:

In 4.1 it is

‘DIRS’: [os.path.join(BASE_DIR, ‘templates’)],