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

2014-11-16 Thread Andreas Ka
I am working through https://docs.djangoproject.com/en/1.7/intro/tutorial02
so far all went fine - but now *templates changes just don't work.*



I think there must be a flaw in that tutorial, something missing,
or something different in django 1.7.1 ?
https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel


my versions:

python -c "import django; print(django.get_version())"
1.7.1

python --version
Python 2.7.3



*SYMPTOM:*

my changes in
mysite/templates/admin/base_site.html
are simply ignored.



These are my files:

mysite# tree
.
├── db.sqlite3
├── manage.py
├── mysite
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── polls
│   ├── admin.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   └── __init__.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
└── templates
└── admin
└── base_site.html



mysite/settings.py:

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


*Whatever I do, the page*
*http://myserver:8000/admin/polls/question/
*
*still keeps the old title 'Django administration'*


I want to understand how templates work, because I need them for my real
project.

Thanks a lot!

-- 
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+unsubscr...@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/CAJAOMegYT3tcJ4W3U6HNUqbomSZVTpWzG3mZVQSsq76-YcC7OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-11-16 Thread 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.



I have actually found more errors in the tutorial:


https://docs.djangoproject.com/en/1.7/intro/tutorial06/#adding-a-background-image
didn't work until I put a  tag into  polls/templates/polls/index.html



https://docs.djangoproject.com/en/1.7/intro/tutorial05/#testing-our-new-view
these tests all come up with one or the other assertion error





On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  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+unsubscr...@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/2dfc3c89-cf1a-411f-ab0b-c15e7e09d501%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+unsubscr...@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/CAJAOMeh2erYyXF_wNtwEJ87b%3DZ1E8T7a%2BwaVn-%2Be_8b-qAEwKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-11-17 Thread Andreas Ka
> Show your view code
The tutorial did not create any view.py for the admin pages



See
https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel

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



and in
https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-change-list
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  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  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+unsubscr...@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/CAJAOMehiM9F9DM9NcR21-P-ZowjVsd4-U9DbDWsR2%2BnQAZ%3DFQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


tutorial bugs: body-tag & view-tests

2014-11-17 Thread Andreas Ka
I have found errors in the tutorial:


https://docs.djangoproject.com/en/1.7/intro/tutorial06/#adding-a-background-image
didn't work until I put a  tag into  polls/templates/polls/index.html



https://docs.djangoproject.com/en/1.7/intro/tutorial05/#testing-our-new-view
these tests all come up with one or the other assertion error




python -c "import django; print(django.get_version())"
1.7.1

python --version
Python 2.7.3

-- 
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+unsubscr...@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/CAJAOMeiQa_FKJvaZr94rHt3sbCLg2XLuB9QHfRq%2BoJUqrbxf9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem with runserver

2014-11-17 Thread Andreas Ka
Good News (for me): I got that sorted.

I had the exact same problems today, with a fresh install of
Java8+eclipse4.4+Anaconda(updated)+django1.7,
and it took me hours ...

SYMPTOM:
from Eclipse ... New PyDev project ... Django ...
I could just not persuade the thing
*to execute any django-admin routines, nor start the server.*
the error message always was something like:

*Could not import settings 'mysite.settings' (Is it on sys.path?): No
module named mysite.settings*
And something about a DJANGO_SETTINGS_MODULE environment variable.


Nowhere, e.g. in https://docs.djangoproject.com/en/1.7/howto/windows/ was
anything mentioned.

I am not 100% sure what it was in the end
(perhaps the django-admin.exe instead of django-admin.py ?) ,
but when I forgot about Eclipse&PyDev, and went to the commandline, and
executed these commands:

django-admin.exe startproject dummy
cd dummy
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
Ctrl-C

I could suddenly create proper projects,
and start the server in Eclipse/pyDev

And it continues to work, even after:
rmdir /S dummy


Hope that helps somehow?


On Mon, Nov 17, 2014 at 10:01 PM, Avraham Serour  wrote:

> It is no clear what is your problem, in all that you wrote I don't see a
> question
>
> On Mon, Nov 17, 2014 at 3:24 PM, Det S. Pillner 
> wrote:
>
>> Hi,
>>
>> yes I know this topic exist, bud:
>>
>> I follow this book:
>>
>> http://www.djangobook.com/en
>>
>> and I can do all the nice things up to the database chapter. I use SVN to
>> save my data and to transfer to other computers. I'm wondering: it does not
>> working on the 'new' machine. Every time I got error message: can't find
>> .settings. Ok. I try a new project: All is working fine. I
>> transfer my data to a new machine: same like before: only error messages.
>> In between I read the 'complete internet' to fix this issue and try all
>> 'solutions'...
>>
>> My problem is: is there another place where django stores settings (yes i
>> know the default_settings). I can change something in settings and django
>> ignores this (I believe). My last try: set  PYTHONPATH to
>> . Wow, it works - one time. What is the
>> right way to set path to settings module? I also try sys.path.append in
>> settings/manage/wsgi.
>>
>> To test I install django in Windows (with Python XY): same problem. No
>> way to settings.
>>
>> Cheers
>>
>> --
>> 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+unsubscr...@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/471379d9-a3c0-446d-b414-6e66ec501de4%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+unsubscr...@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/CAFWa6t%2B0K0ZnD8hQ2upa%2BN2pMvQk60Jy_qH7AsJ7o7Xs%2B95mEA%40mail.gmail.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+unsubscr...@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/CAJAOMeiec3R15rYiwZjHGFs4aqaizFMoaoKMLAuEn_wK8gdDEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-11-21 Thread Andreas Ka
I don't know.
How to test that?



The things I have done were these:
https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customizing-your-project-s-templates

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 
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
>>
>>
>>
>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
>> the-admin-look-and-feel
>>
>> We copied from the Django source files these two into:
>> /mysite/templates/admin/base_site.html
>> and
>> /mysite/templates/admin/index.html
>>
>>
>>
>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>> customize-the-admin-change-list
>> 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  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  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+unsubscr...@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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> 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+unsubscr...@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/CAJAOMej0dhMMhYMCZvP-0o2nX6nXxv7-3KWsL8r3X_Y5nqm44A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-11-22 Thread Andreas Ka
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
when I open http://127.0.0.1:8000/admin/ or
http://127.0.0.1:8000/admin/polls/  ?


Thanks.


On Fri, Nov 21, 2014 at 11:08 PM, donarb  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:
>> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>> customizing-your-project-s-templates
>>
>> 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 
>> 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
>>>>
>>>>
>>>>
>>>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
>>>> the-admin-look-and-feel
>>>>
>>>> We copied from the Django source files these two into:
>>>> /mysite/templates/admin/base_site.html
>>>> and
>>>> /mysite/templates/admin/index.html
>>>>
>>>>
>>>>
>>>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#c
>>>> ustomize-the-admin-change-list
>>>> 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  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
>