Re: Advanced Tutorial (how to write reusable app), last step does not work

2014-11-07 Thread Dennis Kao
Hi 

I just face this same issue and stuck in it for few days, than find out the 
TEMPLATE_LOADERS 
setting,

by default it has two way to find templates:

'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'


but the 

'django.template.loaders.eggs.Loader',

is disable by default,

so, just add these codes to setting.py

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader'
)


than it works fine :)





-- 
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/f18e170d-09f1-4758-8261-f216aae40e0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced Tutorial (how to write reusable app), last step does not work

2014-08-23 Thread Gus Gutoski
Try restarting the web server after installing your new polls package.

I was stuck on this problem for a bit.  You probably don't care anymore 
since this thread is over a year old.  But I thought it might be useful to 
others.

On Friday, 26 July 2013 20:20:26 UTC-4, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>   - 
> /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>
>
>

-- 
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/c5e45306-6d49-450c-8c29-bc23c918e0c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-12-20 Thread Raj
Faced the same problem with the Django 1.6 tutorial... circumvented it by 
renaming "index.html" to "poll_list.html".

Read on if you want to know more about this issue...

It seems there is a problem with the template loader, or the specification 
of which template to load for the generic.ListView.

The generic.DetailView seems to find polls/detail.html and 
polls.results.html templates easily enough.
However, IndexView cannot find polls/index.html.
This is not a template folder specification problem, as all these files are 
in the same folder..

Also, Django specifically says in its error message 
/home/user/website/myweb/polls/templates/polls/index.html, 
polls/poll_list.html (File does not exist)

I don't understand what it means... is it looking for either of the files 
"index.html" (this file exists and is at the correct location) or 
"poll_list.html", or the weirder file "index.html, polls/poll_list.html". 
In the latter case, "index.html, polls" is a directory with a ", " in its 
name.

Template-loader postmortem

Django tried loading these templates, in this order:

   - Using loader django.template.loaders.filesystem.Loader:
  - /home/user/website/myweb/templates/polls/index.html, 
  polls/poll_list.html (File does not exist)
   - Using loader django.template.loaders.app_directories.Loader:
  - 
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/polls/index.html,
 
  polls/poll_list.html (File does not exist)
  - 
/usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/polls/index.html,
 
  polls/poll_list.html (File does not exist)
  - /home/user/website/myweb/polls/templates/polls/index.html, 
  polls/poll_list.html (File does not exist)
   



I tried a fun experiment... created a directory called "index.html, polls" 
under polls/templates/polls and added a file called poll_list.html. On 
refresh, the error message is


   - /home/user/website/myweb/polls/templates/polls/index.html, 
   polls/poll_list.html (File exists)


The theory is correct... Django generic.ListView is looking into a weird 
folder with ", " in its name.
Hopefully, this helps to track the problem.

On Friday, 26 July 2013 17:20:26 UTC-7, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> 

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-10-10 Thread Sebastian Wade
hi,guys
  u should read this content: 
https://docs.djangoproject.com/en/1.0/intro/tutorial04/

> We’re using two generic views here: object_list() and object_detail(). 
> Respectively, those two views abstract the concepts of “display a list of 
> objects” and “display a detail page for a particular type of object.”
>
>
>- Each generic view needs to know what data it will be acting upon. 
>This data is provided in a dictionary. The queryset key in this 
>dictionary points to the list of objects to be manipulated by the generic 
>view.
>- The object_detail() generic view expects the ID value captured from 
>the URL to be called "object_id", so we’ve changed poll_id to object_id 
> for 
>the generic views.
>- We’ve added a name, poll_results, to the results view so that we 
>have a way to refer to its URL later on (see the documentation about 
> naming 
>URL 
> patterns
>  for 
>information). We’re also using the url() function from
>django.conf.urls.defaults here. It’s a good habit to use url() when 
>you are providing a pattern name like this.
>
> By default, the object_detail() generic view uses a template called  name>/_detail.html. In our case, it’ll use the template 
> "polls/poll_detail.html". Thus, rename your polls/detail.html template to 
> polls/poll_detail.html, and change the render_to_response() line in vote()
> .
>
> Similarly, the object_list() generic view uses a template called  name>/_list.html. Thus, renamepolls/index.html to 
> polls/poll_list.html.
>
> Because we have more than one entry in the URLconf that uses 
> object_detail() for the polls app, we manually specify a template name 
> for the results view: template_name='polls/results.html'. Otherwise, both 
> views would use the same template. Note that we use dict() to return an 
> altered dictionary in place.
>


On Saturday, July 27, 2013 8:20:26 AM UTC+8, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>   - 
> /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
>  
>   polls/poll_list.html 

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-10-10 Thread Sebastian Wade
hi, guys
hoped this may help you.
https://docs.djangoproject.com/en/1.0/intro/tutorial04/

> We’re using two generic views here: object_list() and object_detail(). 
> Respectively, those two views abstract the concepts of “display a list of 
> objects” and “display a detail page for a particular type of object.”
>
>
>- Each generic view needs to know what data it will be acting upon. 
>This data is provided in a dictionary. The queryset key in this 
>dictionary points to the list of objects to be manipulated by the generic 
>view.
>- The object_detail() generic view expects the ID value captured from 
>the URL to be called "object_id", so we’ve changed poll_id to object_id 
> for 
>the generic views.
>- We’ve added a name, poll_results, to the results view so that we 
>have a way to refer to its URL later on (see the documentation about 
> naming 
>URL 
> patterns
>  for 
>information). We’re also using the url() function from
>django.conf.urls.defaults here. It’s a good habit to use url() when 
>you are providing a pattern name like this.
>
> By default, the object_detail() generic view uses a template called  name>/_detail.html. In our case, it’ll use the template 
> "polls/poll_detail.html". Thus, rename your polls/detail.html template to 
> polls/poll_detail.html, and change the render_to_response() line in vote()
> .
>
> Similarly, the object_list() generic view uses a template called  name>/_list.html. Thus, renamepolls/index.html to 
> polls/poll_list.html.
>
> Because we have more than one entry in the URLconf that uses 
> object_detail() for the polls app, we manually specify a template name 
> for the results view: template_name='polls/results.html'. Otherwise, both 
> views would use the same template. Note that we use dict() to return an 
> altered dictionary in place.
>
On Saturday, July 27, 2013 8:20:26 AM UTC+8, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>   - 
> /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
>  
>   polls/poll_list.html (File 

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-09-11 Thread Yves
Hi Cate,

I had the same issue while following the tutorial:
https://docs.djangoproject.com/en/1.5/intro/reusable-apps/

A friend of mine explained that it was coming from the packaging. Using 
setuptools/distribute creates 'eggs'.

If you did not solve the issue yet, you can try to add the code below in 
settings.py:

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
*'django.template.loaders.eggs.Loader',*
)

The third line helped me.

I am looking at the different ways to package an app, and will try 
'distutils' to see if it works without using TEMPLATE_LOADERS.

I hope this helps,

Yves

On Friday, July 26, 2013 5:20:26 PM UTC-7, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>   - 
> /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-09-09 Thread Robin Lery
In order to create a reusable app, you have to create a new 'templates'
folder in your app and place the the absolute path in the templates
directory in your settings.py. And then create the html files as concerned
with your app in the templates directory you created within the app.

Robin


On Tue, Sep 10, 2013 at 1:40 AM, asherakhet06  wrote:

> Hello.  I'm a rookie as well and I'm having exactly this same issue.
>  Trying to figure out what to do, but haven't been successful
> unfortunately.  Based on what I read (convention over configuration),  I
> understand that I should to make a poll_list.html file and store this in
> templates, to get my site to work.  Or should I just change the name of my
> index.html file in templates?  Am I missing something here? Thanks a lot
> guys.
>
> On Friday, July 26, 2013 8:20:26 PM UTC-4, Cate Liu wrote:
>>
>>
>> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T
>> and 99.9% worked.
>> Except the last step in the Advanced tutorial, the step 3 in 'Using your
>> own package'.
>> I could see http://127.0.0.1:8000/admin/ and create polls without any
>> problem.
>> But http://127.0.0.1:8000/polls/ would give me the following error.
>>
>> I see there are two problems.
>> 1. /Users/nnn/django_exercises/**mysite/templates/polls/index.**html is
>> the wrong location, it should be $$/django_polls/polls/**
>> templates/polls/index.html.
>> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created
>> this file, no?
>>
>> Thanks for any advice.
>>
>>
>> --**--**
>> --**
>> TemplateDoesNotExist at /polls/
>>
>> polls/index.html, polls/poll_list.html
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django
>> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value:
>>
>> polls/index.html, polls/poll_list.html
>>
>>  Exception Location: /Library/Python/2.7/site-**packages/django/template/
>> **loader.py in select_template, line 194  Python Executable:
>> /usr/bin/python  Python Version: 2.7.2  Python Path:
>>
>> ['/Users/nnn/django_exercises/**mysite',
>>  '/Users/nnn/py_pkg/lib/python/**django_polls-0.1-py2.7.egg',
>>  '/Users/nnn/py_pkg/lib/python'**,
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python27.zip',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/plat-darwin',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/plat-mac',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/plat-mac/lib-**scriptpackages',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**Extras/lib/python',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/lib-tk',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/lib-old',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**lib/python2.7/lib-dynload',
>>  
>> '/System/Library/Frameworks/**Python.framework/Versions/2.7/**Extras/lib/python/PyObjC',
>>  '/Library/Python/2.7/site-**packages']
>>
>>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>>
>> Template-loader postmortem
>>
>> Django tried loading these templates, in this order:
>>
>>- Using loader django.template.loaders.**filesystem.Loader:
>>   - /Users/nnn/django_exercises/**mysite/templates/polls/index.**html,
>>   polls/poll_list.html (File does not exist)
>>- Using loader django.template.loaders.app_**directories.Loader:
>>   - 
>> /Library/Python/2.7/site-**packages/django/contrib/auth/**templates/polls/index.html,
>>   polls/poll_list.html (File does not exist)
>>   - 
>> /Library/Python/2.7/site-**packages/django/contrib/admin/**templates/polls/index.html,
>>   polls/poll_list.html (File does not exist)
>>
>>
>>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-09-09 Thread asherakhet06
Hello.  I'm a rookie as well and I'm having exactly this same issue. 
 Trying to figure out what to do, but haven't been successful 
unfortunately.  Based on what I read (convention over configuration),  I 
understand that I should to make a poll_list.html file and store this in 
templates, to get my site to work.  Or should I just change the name of my 
index.html file in templates?  Am I missing something here? Thanks a lot 
guys.

On Friday, July 26, 2013 8:20:26 PM UTC-4, Cate Liu wrote:
>
>
> I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
> and 99.9% worked.
> Except the last step in the Advanced tutorial, the step 3 in 'Using your 
> own package'.
> I could see http://127.0.0.1:8000/admin/ and create polls without any 
> problem.
> But http://127.0.0.1:8000/polls/ would give me the following error.
>
> I see there are two problems.
> 1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
> wrong location, it should be 
> $$/django_polls/polls/templates/polls/index.html.
> 2. What is polls/poll_list.html?  Nowhere in the tutorial ever created 
> this file, no?
>
> Thanks for any advice.
>
>
>
> --
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html, polls/poll_list.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
> Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 
>
> polls/index.html, polls/poll_list.html
>
>  Exception Location: 
> /Library/Python/2.7/site-packages/django/template/loader.py 
> in select_template, line 194  Python Executable: /usr/bin/python  Python 
> Version: 2.7.2  Python Path: 
>
> ['/Users/nnn/django_exercises/mysite',
>  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
>  '/Users/nnn/py_pkg/lib/python',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
>  Server time: Fri, 26 Jul 2013 16:59:14 -0700
>
> Template-loader postmortem 
>
> Django tried loading these templates, in this order:
>
>- Using loader django.template.loaders.filesystem.Loader: 
>   - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
>   polls/poll_list.html (File does not exist)
>- Using loader django.template.loaders.app_directories.Loader: 
>   - 
> /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>   - 
> /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
>  
>   polls/poll_list.html (File does not exist)
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Advanced Tutorial (how to write reusable app), last step does not work

2013-07-27 Thread Christian Erhardt
Django is using a coding "style" called covention over configuration. That 
means that you don't have to configure every bit of your application instead a 
convention is used to determine where you have to place stuff so django finds 
and uses it. For the beginner it seems like django is using some sort of magic 
to connect erlverything together.
In your case, having read the tutorial a long time ago, you surely created a 
View class that is derived from the ListView base class. The convention here is 
that you create a template called _list.html. If you have a file 
with this name, the listview will use it for rendering. It seems the creation 
of this file is missing in the tutorial. But it is pretty straight forward if 
you look at the documentation of the listview base class.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-07-26 Thread Mike Dewhirst

On 27/07/2013 10:20am, Cate Liu wrote:


I am a new newbie to Django.  Great tutorial BTW.  I followed it to the
T and 99.9% worked.
Except the last step in the Advanced tutorial, the step 3 in 'Using your
own package'.
I could see http://127.0.0.1:8000/admin/ and create polls without any
problem.
But http://127.0.0.1:8000/polls/ would give me the following error.

I see there are two problems.
1. |/Users/nnn/django_exercises/mysite/templates/polls/index.html is the
wrong location, it should be
$$/django_polls/polls/templates/polls/index.html.
2. What is ||polls/poll_list.html?|  Nowhere in the tutorial ever
created this file, no?


I don't know the tutorial and haven't looked through it but you have 
definitely called for poll_list.html somewhere in your code.


The first place to look is in your urls.py. Try and see how the URL you 
entered is being interpreted. It is probably calling a view (in 
views.py?) which names poll_list.html directly.


I put print statements in my settings.py if DEBUG == True which show my 
static, media and template locations every time I use manage.py 
runserver. It is very helpful when debugging file locations.


You might also try http://127.0.0.1:8000/admin/polls/



Thanks for any advice.


--


  TemplateDoesNotExist at /polls/

polls/index.html, polls/poll_list.html

Request Method: GET
Request URL:http://127.0.0.1:8000/polls/
Django Version: 1.5.1
Exception Type: TemplateDoesNotExist
Exception Value:

polls/index.html, polls/poll_list.html

Exception Location:
/Library/Python/2.7/site-packages/django/template/loader.py in
select_template, line 194
Python Executable:  /usr/bin/python
Python Version: 2.7.2
Python Path:

['/Users/nnn/django_exercises/mysite',
  '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
  '/Users/nnn/py_pkg/lib/python',
  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
  
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
  '/Library/Python/2.7/site-packages']

Server time:Fri, 26 Jul 2013 16:59:14 -0700



Template-loader postmortem

Django tried loading these templates, in this order:

  * Using loader |django.template.loaders.filesystem.Loader|:
  o |/Users/nnn/django_exercises/mysite/templates/polls/index.html,
polls/poll_list.html| (File does not exist)
  * Using loader |django.template.loaders.app_directories.Loader|:
  o 
|/Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
polls/poll_list.html| (File does not exist)
  o 
|/Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
polls/poll_list.html| (File does not exist)


--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Advanced Tutorial (how to write reusable app), last step does not work

2013-07-26 Thread Cate Liu

I am a new newbie to Django.  Great tutorial BTW.  I followed it to the T 
and 99.9% worked.
Except the last step in the Advanced tutorial, the step 3 in 'Using your 
own package'.
I could see http://127.0.0.1:8000/admin/ and create polls without any 
problem.
But http://127.0.0.1:8000/polls/ would give me the following error.

I see there are two problems.
1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the 
wrong location, it should be 
$$/django_polls/polls/templates/polls/index.html.
2. What is polls/poll_list.html?  Nowhere in the tutorial ever created this 
file, no?

Thanks for any advice.


--
TemplateDoesNotExist at /polls/ 

polls/index.html, polls/poll_list.html

 Request Method: GET  Request URL: http://127.0.0.1:8000/polls/  Django 
Version: 1.5.1  Exception Type: TemplateDoesNotExist  Exception Value: 

polls/index.html, polls/poll_list.html

 Exception Location: 
/Library/Python/2.7/site-packages/django/template/loader.py 
in select_template, line 194  Python Executable: /usr/bin/python  Python 
Version: 2.7.2  Python Path: 

['/Users/nnn/django_exercises/mysite',
 '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
 '/Users/nnn/py_pkg/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages']

 Server time: Fri, 26 Jul 2013 16:59:14 -0700

Template-loader postmortem 

Django tried loading these templates, in this order:

   - Using loader django.template.loaders.filesystem.Loader: 
  - /Users/nnn/django_exercises/mysite/templates/polls/index.html, 
  polls/poll_list.html (File does not exist)
   - Using loader django.template.loaders.app_directories.Loader: 
  - 
/Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
 
  polls/poll_list.html (File does not exist)
  - 
/Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
 
  polls/poll_list.html (File does not exist)
   

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.