Re: New User Stuck on Tutorial Part 2

2010-05-11 Thread Old Davy

Thanks, Mike...  I've got some studying to do!  :)

On 05/10/2010 11:47 PM, Mike Dewhirst wrote:

On 11/05/2010 4:04pm, 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 %}
{% trans 'Mysite administration' %}
{% 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" %}


Just realised I could have confused you a little.

So

You can extend anything you want to specifically nominate but if you 
just nominate a bare filename the way I do with base.html in ...


   mysite/templates/admin/base_site.html

... base.html has to exist in TEMPLATE_DIRS (mysite/templates)

If you want to extend "admin/base.html" from the above base_site.html 
then Django looks first in ...


   TEMPLATES_DIR/admin

... and if it doesn't find it then it looks in 
site-packages/django/contrib/admin/templates/admin


Mike



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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Mike Dewhirst

On 11/05/2010 4:04pm, 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 %}
{% trans 'Mysite administration' %}
{% 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" %}


Just realised I could have confused you a little.

So

You can extend anything you want to specifically nominate but if you 
just nominate a bare filename the way I do with base.html in ...


   mysite/templates/admin/base_site.html

... base.html has to exist in TEMPLATE_DIRS (mysite/templates)

If you want to extend "admin/base.html" from the above base_site.html 
then Django looks first in ...


   TEMPLATES_DIR/admin

... and if it doesn't find it then it looks in 
site-packages/django/contrib/admin/templates/admin


Mike



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...






--

Climate Pty Ltd
PO Box 308
Mount Eliza
Vic 3930
Australia +61

T: 03 9787 6598
M: 0411 704 143

Mike Dewhirst
Certified Scrum Master


--
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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Mike Dewhirst

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 %}
{% trans 'Mysite administration' %}
{% 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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Old Davy

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.


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 %}
{% trans 'Mysite administration' %}
{% 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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Mike Dewhirst

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 %}
{% trans 'Mysite administration' %}
{% 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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Old Davy

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"

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.



Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Shawn Milochik
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

-- 
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.



New User Stuck on Tutorial Part 2

2010-05-10 Thread llanitedave
Using Ubuntu 10.04...

I'm just starting out on django and going through the tutorials.
Everything installed, got the polls working in parts 1 and 2 of the
tutorial, and I think I'm sailing.  Then I get to the bottom of Part
2, to the section "Customize the admin look and feel".

In settings.py I followed the instructions:

"Now copy the template admin/base_site.html  from within the default
Django admin template directory (django/contrib/admin/templates) into
an admin subdirectory of whichever directory you're using in
TEMPLATE_DIRS. For example, if your TEMPLATE_DIRS  includes "/home/
my_username/mytemplates", as above, then copy django/contrib/admin/
templates/admin/base_site.html  to /home/my_username/mytemplates/admin/
base_site.html. Don't forget that admin subdirectory.

Then, just edit the file and replace the generic Django text with your
own site's name as you see fit."

I changed the title in my local admin folder to this:

{% block title %}{{ title }} | {% trans "Dave's Tutorials" %}{%
endblock %}

{% block branding %}
{% trans "Dave's Tutorials" %}
{% endblock %}

Nothing happened.  My page still reads "Django Administration.

I stopped the server, ran syncdb, and restarted the server.  No
change.

Thinking that somehow TEMPLATE_DIRS wasn't registering the new
location, I went back to the default director, which is in the /home/
local/share... directory, renamed the original and edited a new
base_site.html as I had done in my tutorial directory.

As before, ran syncdb and restarted the server.

Still no change.  So now I'm stuck.  Why is settings.py ignoring both
the local and the default files?  Or is the default file someplace
that I haven't found yet?

Thanks for any advice you can give!

-- 
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.