Customizing your project's templates

22 views
Skip to first unread message

Sheharyar Hamayun

unread,
Oct 20, 2013, 11:52:48 PM10/20/13
to django...@googlegroups.com
Ok, so i've copied the base_site html to lotus/pollapp/mysite/polls/templates/admin . I've opened the html file in a text editor and changed

 <h1 id="site-name">{% trans 'Django administration' %}</h1>   to

<h1 id="site-name">{% trans 'Pollapp' %}</h1>

However this change doesn't show on the website. My Template DIRS is:

TEMPLATE_DIRS = (
    'lotus/pollapp/mysite/polls/templates',
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

I've restarted the dev server and refreshed the website many times, but still no change.
Any help with what i'm doing wrong?

Leonardo Giordani

unread,
Oct 21, 2013, 8:31:14 AM10/21/13
to django...@googlegroups.com
I think that you are missing the absolute path part of the code comment


    # Don't forget to use absolute paths, not relative paths.

This means that you cannot use 'lotus/...'
Usually you use code like

ABSOLUTE_PATH = '%s/' %(os.path.abspath(os.path.dirname(locals()['__file__'])).replace('\\', '/'))

at the beginning of your settings.py file. Then you can write

TEMPLATE_DIRS = (
    os.path.join(ABSOLUTE_PATH, 'lotus/pollapp/mysite/polls/templates'),
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

Remember that settings.py is a Python module, so you can use any valid Python code.

Let me know if you succeed.
Cheers,

Leo


Leonardo Giordani
Author of The Digital Cat
My profile on About.me - My GitHub page - My Coderwall profile


2013/10/21 Sheharyar Hamayun <sheharyar....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5fb2f9b7-8340-4be4-8ba9-cfd8536404a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sheharyar Hamayun

unread,
Oct 26, 2013, 3:05:15 AM10/26/13
to django...@googlegroups.com
Hey

Yes, thank you. It worked!

Btw sorry for the late reply, my previous 'thank you' reply didn't seem to go through it seems. 
Reply all
Reply to author
Forward
0 new messages