kirska7
kirska7

Reputation: 1

Template changes are not appearing in Django admin site

I am going through the Django tutorial, step 2 found here: https://docs.djangoproject.com/en/1.7/intro/tutorial02/

I've followed the steps in the tutorial and here is my file structure:

mysite
----mysite
--------templates
------------admin
----------------base_site.html
--------settings.py
----polls
----manage.py

Here is the change I made in settings.py:

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

#this is the change
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

Here are the contents of base_site.html:

{% extends "admin/base.html" %}

{% block title %}{{ title }} | {{ site_title|default:_('Polls site admin') }}{% endblock %}

{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Polls administration') }}</a></h1>
{% endblock %}

{% block nav-global %}{% endblock %}

I don't understand what I'm doing wrong. None of the changes show up in the admin site. I've restarted it several times. It still shows the default "Django administration" etc. I've even tried clearing my browser cache.

Edit: I also tried it in a different browser just to double check and the changes still do not appear.

Help!

Upvotes: 0

Views: 675

Answers (1)

schillingt
schillingt

Reputation: 13731

Your templates directory is one level below where you're telling Django to look.

Either change it to:

PROJECT_DIR = os.path.dirname(__file__)
BASE_DIR = os.path.dirname(PROJECT_DIR)

#this is the change
TEMPLATE_DIRS = [os.path.join(PROJECT_DIR, 'templates')]

Or change it to:

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

#this is the change
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'mysite', 'templates')]

Upvotes: 1

Related Questions