On 11/05/2010 4:18pm, Old Davy wrote:
Thank you, Mike.  That DID work!

So, if I have a directory that contains the /admin/base_site.html, all I
have to do is specify the containing directory.

I'll need to study the actual string you used a little more closely once
I get more familiar with the concepts. I can see how that would give you
some added flexibility, but I'm not quite grokking the details yet.

OK - here is more room for confusion ...

In my settings.py ...

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)).replace('\\','/')

This is Python for getting the current directory path to the file in which the above code appears. Since it is in settings.py it returns my PROJECT_ROOT. The replace() just makes it cross-platform because I work in both Windows and Linux.

What follows is also in settings.py and is what makes what I said in my previous email true. Notice the comment? If filesystem loader appeared *after* the app_directories loader my previous email would have taken you right to the fairies at the end of the garden path.

TEMPLATE_LOADERS = (
    # filesystem ahead of app_directories looks in project before django
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
    'django.template.loaders.eggs.load_template_source',

Mike


Still, at least I can continue the tutorial without that "mired in the
mud" feeling. Thank you very much!!!



On 05/10/2010 11:04 PM, Mike Dewhirst wrote:
On 11/05/2010 3:42pm, Old Davy wrote:
On 05/10/2010 08:18 PM, Shawn Milochik wrote:
Exactly what directory is your copied template in? It's most likely
not in the right place.

Ensure that you have a template dir that your settings knows about,
and that template dir has a subdirectory called 'admin' where that
file is placed.

Shawn

That would make the most sense, and that would be my working assumption.
But I can't for the life of me see where the disconnect is.

this is the string that's in the TEMPLATE_DIRS section of my settings.py
file:

"/home/llanitedave/Development/djangoProjects/django1.1Training/mysite/admin/base_site.html"


You want a directory rather than a file (base_site.html) for
TEMPLATE_DIRS

This is mine ...

# if templates are not found here look in app_name/templates
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT,
'templates').replace('\\','/'),)

This puts my templates directory in the same dir as my settings.py file.

Inside it I have a sub-dir for each application for which I want
templates. For example, in one of them I have ...

../templates/admin/base_site.html

Which contains ...

{% extends "base.html" %}
{% load i18n %}

{% block title %}{{ title }} | {% trans 'Mysite site admin' %}{%
endblock %}

{% block branding %}
<h1 id="site-name">{% trans 'Mysite administration' %}</h1>
{% endblock %}

... and which turns Django Admin into Mysite admin. However, the
"base.html" which it extends is actually in ../templates

If I wanted Mysite base_site.html to extend the real Django base.html
I would have to put ... {% extends "admin/base.html" %}

HTH

Mike




That's exactly the path that my directories show, including my
idiosyncratic upper case letters.

I did find the file that my poll app is referencing. Turns out it was in
my '/usr/local/lib/python2.6... path instead of my home directory. So
when I modified THAT file, it used my changes. However, that still
doesn't help, as it's not using the file that I copied to my local
directory.

I suppose I can play with a few more directories and see what happens...




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to