Re: New User Stuck on Tutorial Part 2
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
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
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.