Saturday, November 22, 2014

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

Thanks for your help.

I really think there is something wrong with that part of the tutorial. A small thing, but wrong.


Check your settings file,
> are there two TEMPLATE_DIRS variables defined?

Nope. 


This is where I placed it:

...
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
...


just tried this:

import mysite.settings as settings
print settings.TEMPLATE_DIRS
['D:\\Programming\\eclipse\\mysite\\templates']

so no: not empty.


Why is my file templates/admin/base_site.html never called


Thanks.


On Fri, Nov 21, 2014 at 11:08 PM, donarb <donarb@nwlink.com> wrote:
On Friday, November 21, 2014 10:59:19 AM UTC-8, Andreas Ka wrote:
I don't know.
How to test that?



The things I have done were these:

mkdir templates
mkdir templates/admin
cp /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html templates/admin/

ls -l templates/admin/base_site.html
-rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
(and www-data is member of that group)

nano templates/admin/base_site.html   -> changed it to what I want to see
nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

restarted the server.







On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson <cmawe...@gmail.com> wrote:
Hi,

Do other templates work in that folder?

Collin


On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:

> Show your view code
The tutorial did not create any view.py for the admin pages




We copied from the Django source files these two into:
/mysite/templates/admin/base_site.html
and
/mysite/templates/admin/index.html



edited:


admin.py

from django.contrib import admin

# Register your models here.

from django.contrib import admin
from polls.models import Choice, Question


class ChoiceInline(admin.TabularInline):
    model = Choice
    extra = 3


class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
    ]
    inlines = [ChoiceInline]
    list_display = ('question_text', 'pub_date', 'was_published_recently')
    list_filter = ['pub_date']
    search_fields = ['question_text']    

admin.site.register(Question, QuestionAdmin)


-------



On Mon, Nov 17, 2014 at 2:11 PM, Artie <giliar...@gmail.com> wrote:
Are you sure about correct path to your templates in views?

Show your view code

понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka написал:
thanks for your answer.

yes, I just tried that. Same result.
 
By now, I have understood much more about the templates.
 
But still, for the admin pages
mysite/templates/admin/base_site.html   
doesn't work yet.


...

On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE <rlfu...@gmail.com> wrote:
Obviously you've restarted the server and refreshed the page in such a way to ensure it's not a caching issue ?

 
 

--
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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Check your settings file, are there two TEMPLATE_DIRS variables defined? Possibly you created one in your edit, but Django already has an empty one defined. If your edit was placed before the one that is already defined, it would end up empty, hence no override. 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/5d66c7ab-92c0-4da7-9346-e25f3b2b8dcd%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAJAOMejQ1zv835HrRVcbq0pacwkZbnv2ES6GKgmJZESBKrLSCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment