[Answered ]-How to override Django-CMS templates

2👍

First off, if it redirects you to the login page, that’ll most likely be because there isn’t any content yet. Based on the question, I’m assuming this is a new installation with no pages, so you’d need to login, create your pages, and then you should get it to load without the admin redirect.

In terms of overriding templates, it works the same as for any django or app template.

If you want to use a custom template, you simply create your own version following the same path as the original, but in one of your own template directories.

For example I’ve got a directory in my project where I override CMS templates;

/project/myapp/templates/cms/toolbar/plugin.html

Which you can see in the CMS app lives in that same template path;

https://github.com/divio/django-cms/tree/release/3.3.x/cms/templates/cms/toolbar

If you’ve got templates that you wish to make available as page templates for the CMS then there is a CMS_TEMPLATES setting which you add like so;

CMS_TEMPLATES = (
    ('home.html', 'Homepage'),
    ('article.html', 'Article'),

    ('blogs/entry_form.html', 'Blogs Competition Entry Form'),
)

Leave a comment