user3697878
user3697878

Reputation: 65

Django customizing admin templates did not always change them

Copied base_site.html from my defaults templates (project\Lib\site-packages\django\contrib\admin\templates\admin) to my app (project\mysite\polls\templates\admin) and it works with my custom version of it. But with 404.html it does not work so (I even changed it in original template, and still 404 is intact)

Upvotes: 0

Views: 24

Answers (1)

not2acoder
not2acoder

Reputation: 1152

404 page cannot be overridden on a per app basis as mentioned in the docs:

For those templates that cannot be overridden in this way, you may still override them for your entire project. Just place the new version in your templates/admin directory. This is particularly useful to create custom 404 and 500 pages.

To override the 404.html for admin panel, create a file named 404.html and place it inside your_project/templates folder.

After that turn DEBUG=False. Then you will be able to see your custom html.

Upvotes: 1

Related Questions