Monday, October 31, 2011

Disk I/O Error

I'm getting a DatabaseError, looking like this:

Django Version: 1.3
Exception Type: DatabaseError
Exception Value: disk I/O error
Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/
backends/sqlite3/base.py in execute, line 234

whenever I try to read or write to any of the databases associated
with any of the websites on one of our servers. The fact that all
these websites work locally, but not in their live versions seems to
suggest to me that something has gone wrong on the server, rather than
with django, but I thought I'd better ask and see if any one has had
any similar issues. I'm running python 2.6.6, django 1.3 and they're
on a Linux server.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: new formwizard - how to pass data between forms

Awesome! Let me know how it works out for you. I'll probably be giving it a try shortly as well. Thanks for sharing the good information.

On Mon, Oct 31, 2011 at 6:43 PM, andreas <dalebc@gmail.com> wrote:
Hey Kurtis,

thanks for your answer.

I think hidden fields were used in the old implementation.
At least the release notes for 1.4 say:
"It features a pluggable storage API and doesn't require the wizard to
pass around hidden fields for every previous step."
But checking the example apps (https://github.com/stephrdev/django-
formwizard/blob/master/test_project/testapp2/views.py#L20
) i found
what i was looking for:
get_cleaned_data_for_step()

It does exactly what i need :-)

On 31 Okt., 03:07, Kurtis Mullins <kurtis.mull...@gmail.com> wrote:
> I haven't read that particular back ports docs but when I looked at the dev docs for the new form wizard a little while back, I believe that it stores all previous data as hidden fields throughout the process. So I would think form.cleaned_data should contain everything. Hopefully that helps a little :)
>
> Sent from my iPad
>
> On Oct 29, 2011, at 11:19 AM, andreas <dal...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > i am using the backport of django's new formwizard (https://github.com/
> > stephrdev/django-formwizard).
> > and i am looking for the recommended way to pass data between the
> > different forms/steps.
>
> > Basically i am using the formwizard to process a series of forms that
> > let the user (further) specify filter options from step to step.
> > For example in the first step you would choose from a list of
> > countries, the next form would give you the states form these
> > countries and the final result of the wizard (done()) renders a list
> > of the major cities in these states.
>
> > If i use get_form_kwargs (https://docs.djangoproject.com/en/dev/ref/
> > contrib/formtools/form-wizard/
> > #django.contrib.formtools.wizard.views.WizardView.get_form_kwargs) i
> > can access the data from the previous step via self.request.POST and
> > pass   the selected choices to the form constructor of the next form
> > where i then filter the choices of the relevant field.
>
> > But is it also possible to access the selected data fron step 1 in
> > step4?
> > Something like get_all_cleaned_data() but just for the processed
> > steps?
>
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Can't add superuser

On Nov 1, 4:43 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Oct 31, 2011 at 8:43 AM, rihad <ri...@mail.ru> wrote:
> > Hi, I'm unable to add superuser. Running latest development trunk of
> > Django, & Python 2.7
>
> This has been reported:https://code.djangoproject.com/ticket/16017
>
> One way to fix it would be to get a locale properly set on your machine.

Thanks. I just set LANG=en_US.UTF-8 (from empty), dropped the
auth_user & django_site tables for them to be recreated, ran "manage
syncdb", and now everything works. Apparently it's a new quirk of
Django, earlier releases didn't care if LANG was set.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Why are my two django objects of the same type behaving differently?

Somebody answered this
http://stackoverflow.com/questions/7954474/why-are-my-two-django-objects-of-the-same-type-behaving-differently

...
>>> s = '%build%'
>>> content_query = content_class.objects.raw("Select * from pms_building where name like %s",[s])
>>> type(content_query)
<Building: Building A>

Works well.

Thanks

On Oct 31, 5:30 pm, Gath <pgath...@gmail.com> wrote:
> Help!
>
> I have two objects that i have created using different techniques in
> django;
>
> >>> from django.contrib.contenttypes.models import ContentType
> >>> from myproject.models import Building
>
> Method A
>
> >>> content_type = ContentType.objects.get(app_label='myproject', model='Building')
> >>> content_class = content_type.model_class()
> >>> content_query = content_class.objects.raw("Select * from pms_building where name like '%build%' ")
> >>> type(content_query)
>
> <class 'django.db.models.query.RawQuerySet'>>>> content_query[0]
>
> # error ....
> # Attribute: 'str' object has no attribute 'items'
>
> Method B
>
> >>> bld = Building.objects.raw("Select * from pms_building where name like '%build%' ")
> >>> type(bld)
>
> <class 'django.db.models.query.RawQuerySet'>
>
> >>>bld[0]
>
> <Building: Building A>
>
> My question is why are the two objects of the same type behaving
> differently?
>
> Gath

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django - tutorial part 2 problem - Permission denied when attempting to save file

It looks like you don't have write permissions to the "base_site.html"
file, or if the file doesn't exist, than you likely don't have proper
permissions for the enclosing folder. What is the full path of the file
you're attempting to edit?

On 10/31/2011 6:30 PM, BillB1951 wrote:
> Got this error
> Ran into this as part of the Django tutorial (part 2) very close to
> the bottom .... an attempt to change the page header/title.
>
>
> "There was an error attempting to save 'base_site.html':Permission
> denied"
>
> when trying to save the file below (copied from django source code)
>
>
>
> {% extends "admin/base.html" %}
> {% load i18n %}
>
> {% block title %}{{ title }} | {% trans 'Django site admin' %}{%
> endblock %}
>
> {% block branding %}
> <h1 id="site-name">{% trans 'Django administration' %}</h1>
> {% endblock %}
>
> {% block nav-global %}{% endblock %}
>
>
> any thoughts?
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: I can't activate the admin site

On Mon, 2011-10-31 at 17:31 +0200, Nick Apostolakis wrote:
> On 31/10/2011 02:12 μμ, kenneth gonsalves wrote:
> >
> > but the indentation error seems to be in the django source code?
> > Normally one does not fiddle with that.
> >
>
> no I wouldn't expect the indentation problem to be located in django
> code.
> unless you are using an unstable version or something....
>
>

the source might have got corrupted. A reinstall may solve the problem.
--
regards
Kenneth Gonsalves

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django - tutorial part 2 problem - Permission denied when attempting to save file

Got this error
Ran into this as part of the Django tutorial (part 2) very close to
the bottom .... an attempt to change the page header/title.


"There was an error attempting to save 'base_site.html':Permission
denied"

when trying to save the file below (copied from django source code)

{% extends "admin/base.html" %}
{% load i18n %}

{% block title %}{{ title }} | {% trans 'Django site admin' %}{%
endblock %}

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

{% block nav-global %}{% endblock %}


any thoughts?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Can't add superuser

On Mon, Oct 31, 2011 at 8:43 AM, rihad <rihad@mail.ru> wrote:
Hi, I'm unable to add superuser. Running latest development trunk of
Django, & Python 2.7


This has been reported: https://code.djangoproject.com/ticket/16017

One way to fix it would be to get a locale properly set on your machine. Another would be to read that ticket and try patching your Django with one of the patches attached there.

Karen
--
http://tracey.org/kmt/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django tutorial hasn't received an update for 1.3

On Mon, Oct 31, 2011 at 3:08 PM, Kevin <kveroneau@gmail.com> wrote:
> I keep checking the tutorial page for version 1.3 hoping to see some
> new content related to the class-based views or at least some of the
> promised future tutorials.  The tutorial still has the function-based
> views, and no new updates since I first went through it on the 1.2
> release.
>
> I know the function views work in 1.3, but shouldn't the tutorial be
> using the latest features included in 1.3 so that new users coming to
> Django begin learning the newest features, such as class-based views.
>
> I'm still a dinosaur and using Django 1.2 and haven't yet dived into
> class-based views, and when I do, I would love a great tutorial on how
> to proceed.  I plan on learning Django 1.3's newest features very soon
> to keep myself up to speed and see if my current apps are fully
> compatible.
>
> Are there any updates on when we will see the following new tutorial
> sections:

Unfortunately, we can't give you an estimate of when more tutorials
will land -- the only real answer is "when they're written".

One of the embarrasing things about Django's docs is that Tutorial 4
ends with "More tutorials coming soon". It said when *I* started using
Django -- 6 years ago.

This is definitely something that I would like to see addressed;
however, good tutorials are time consuming to write, and nobody has
volunteered to write one (there is a draft for a Tutorial 5 that has
been waiting for review for a couple of months, however).

All the topics you list, and many many more, would be excellent
candidates for tutorials. If *anyone* wants to get started with
contributing to Django, writing tutorials would be a great way to help
out.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: I can't activate the admin site

Thank you all.
I'm using Django 1.3
I may need to rewrite the file sites.py
I'm sure I did not change anything in that file.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: new formwizard - how to pass data between forms

Hey Kurtis,

thanks for your answer.

I think hidden fields were used in the old implementation.
At least the release notes for 1.4 say:
"It features a pluggable storage API and doesn't require the wizard to
pass around hidden fields for every previous step."
But checking the example apps (https://github.com/stephrdev/django-
formwizard/blob/master/test_project/testapp2/views.py#L20
) i found
what i was looking for:
get_cleaned_data_for_step()

It does exactly what i need :-)

On 31 Okt., 03:07, Kurtis Mullins <kurtis.mull...@gmail.com> wrote:
> I haven't read that particular back ports docs but when I looked at the dev docs for the new form wizard a little while back, I believe that it stores all previous data as hidden fields throughout the process. So I would think form.cleaned_data should contain everything. Hopefully that helps a little :)
>
> Sent from my iPad
>
> On Oct 29, 2011, at 11:19 AM, andreas <dal...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > i am using the backport of django's new formwizard (https://github.com/
> > stephrdev/django-formwizard).
> > and i am looking for the recommended way to pass data between the
> > different forms/steps.
>
> > Basically i am using the formwizard to process a series of forms that
> > let the user (further) specify filter options from step to step.
> > For example in the first step you would choose from a list of
> > countries, the next form would give you the states form these
> > countries and the final result of the wizard (done()) renders a list
> > of the major cities in these states.
>
> > If i use get_form_kwargs (https://docs.djangoproject.com/en/dev/ref/
> > contrib/formtools/form-wizard/
> > #django.contrib.formtools.wizard.views.WizardView.get_form_kwargs) i
> > can access the data from the previous step via self.request.POST and
> > pass   the selected choices to the form constructor of the next form
> > where i then filter the choices of the relevant field.
>
> > But is it also possible to access the selected data fron step 1 in
> > step4?
> > Something like get_all_cleaned_data() but just for the processed
> > steps?
>
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: TabularInline "Add another" link not clickable

This CSS tweak fixed it:

div.inline-group {
display: inline-block;
}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

Yeah. Tuples catch a lot of folks. Just because the empty tuple is
spelled () .

At the risk of telling you something that you already know:

The app_directories_ loader should pull this stuff in for you, so long as
django.contrib.admin is in INSTALLED_APPS. Usually TEMPLATE_DIRS
is used to include a "templates" directory in your project root.

On Mon, Oct 31, 2011 at 5:17 PM, Stefan Lisowski <s.lisowski@isti.com> wrote:
> On 10/31/2011 3:51 PM, Bill Freeman wrote:
>>
>> Try putting a comma at the end of the TEMPLATE_DIRS line.
>
> Hurrah, that did it. Thanks Mr. Freeman.
>
>> Parentheses do not the tuple make.  It's the comma.  An expression
>> surrounded by parentheses is just the expression, so you're trying to
>> use each letter of your setting as a directory, I believe.
>
> I assumed a single directory could be a case of a single element. Tuple
> lesson duly noted.
>
>> I take it you're not using the app directories loader?
>
> Not yet.
>
> - Stefan
>
>> On Mon, Oct 31, 2011 at 3:58 PM, Stefan Lisowski<s.lisowski@isti.com>
>>  wrote:
>>>
>>> On 10/31/2011 2:49 PM, Bill Freeman wrote:
>>>>
>>>> I think that you have too many "admin"s.  Try:
>>>>
>>>>
>>>>
>>>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates')
>>>
>>> Thanks for the suggestion. I don't see much difference on my system here
>>> though...
>>>
>>> C:\Program Files (x86)\Microsoft Visual Studio
>>> 8\VC>c:\Python26\python.exe
>>> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
>>> (Intel)]
>>> on
>>> win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>>
>>>>>> import django.template
>>>>>>
>>>>>>
>>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates'),TEMPLATE_DEBUG=True,
>>>>>> DEBUG=True)
>>>>>> import django.template.loader as loader
>>>>>> loader.get_template("base.html")
>>>
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in<module>
>>>  File "c:\Python26\lib\site-packages\django\template\loader.py", line
>>> 157,
>>> in get_template
>>>    template, origin = find_template(template_name)
>>>  File "c:\Python26\lib\site-packages\django\template\loader.py", line
>>> 138,
>>> in find_template
>>>    raise TemplateDoesNotExist(name)
>>> django.template.base.TemplateDoesNotExist: base.html
>>>>>>
>>>>>> loader.get_template("admin/base.html")
>>>
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in<module>
>>>  File "c:\Python26\lib\site-packages\django\template\loader.py", line
>>> 157,
>>> in get_template
>>>    template, origin = find_template(template_name)
>>>  File "c:\Python26\lib\site-packages\django\template\loader.py", line
>>> 138,
>>> in find_template
>>>    raise TemplateDoesNotExist(name)
>>> django.template.base.TemplateDoesNotExist: admin/base.html
>>>
>>> Has anyone here used the template system successfully without using all
>>> of
>>> Django?
>>>
>>>>
>>>> On Mon, Oct 31, 2011 at 3:30 PM, Stefan Lisowski<s.lisowski@isti.com>
>>>>  wrote:
>>>>>
>>>>> I appreciate the reply SmileyChris -
>>>>>
>>>>> On 10/30/2011 12:41 PM, SmileyChris wrote:
>>>>>>
>>>>>> Take a read through this section of the docs:
>>>>>>
>>>>>>
>>>>>> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates
>>>>>
>>>>> Yes, that's what I was reading.
>>>>>
>>>>>> Specifically, those templates are found via the
>>>>>> app_directories.Loader.
>>>>>> So you'd run loader.get_template('admin/base.html') to get that
>>>>>> template. The reason that it's in a subdirectory is to avoid conflicts
>>>>>> with other applications (since they may want to use their own
>>>>>> 'base.html' template.
>>>>>
>>>>> So, my setting TEMPLATE_DIRS here to the actual subdirectory would not
>>>>> work?
>>>>>
>>>>>
>>>>>
>>>>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')
>>>>>
>>>>> I used this as an example to point to some templates that are known to
>>>>> work,
>>>>> rather than point to my own templates that don't work either. If I go
>>>>> into
>>>>> the Django code and print out the directory that's being searched, I
>>>>> see
>>>>> the
>>>>> correct directory there, so I don't know why things are failing. Maybe
>>>>> I'm
>>>>> just not instantiating things correctly?
>>>>>
>>>>> In any case, I tried your suggestion, but still no luck:
>>>>>
>>>>>>>> loader.get_template('admin/base.html')
>>>>>
>>>>> Traceback (most recent call last):
>>>>>  File "<stdin>", line 1, in<module>
>>>>>  File "django/template/loader.py", line 164, in get_template
>>>>>    template, origin = find_template(template_name)
>>>>>  File "django/template/loader.py", line 145, in find_template
>>>>>    raise TemplateDoesNotExist(name)
>>>>> django.template.base.TemplateDoesNotExist: admin/base.html
>>>>>
>>>>> (I also tried without manually setting TEMPLATE_DIRS, but just ran
>>>>> django.conf.settings.configure(), still to no avail.)
>>>>>
>>>>> Anyone, any ideas? I'm completely new to Django, but I've not been
>>>>> working
>>>>> in Python lately either, so it could just be a Python mistake on my
>>>>> part.
>>>>>
>>>>> - Stefan
>>>>>
>>>>> -------- Original Message --------
>>>>> Subject: Django Standalone Template
>>>>> Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
>>>>> From: Stefan Lisowski<s.lisowski@isti.com>
>>>>> Reply-To: django-users@googlegroups.com
>>>>> To: Django users<django-users@googlegroups.com>
>>>>>
>>>>> Hi Django folks -
>>>>>
>>>>> I'm new to Django, and I just want to use the template system now,
>>>>> independent of the rest of Django. But I can't get it to see a
>>>>> template. Even the system templates as was suggested when I started
>>>>> Googling for my error.
>>>>>
>>>>>>>> import django.template
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True,
>>>>>>>> DEBUG=True)
>>>>>>>> import django.template.loader as loader
>>>>>>>> loader.get_template("base.html")
>>>>>
>>>>> Traceback (most recent call last):
>>>>>  File "<stdin>", line 1, in<module>
>>>>>  File "c:\python26\lib\site-packages\django\template\loader.py", line
>>>>> 157, in get_template
>>>>>    template, origin = find_template(template_name)
>>>>>  File "c:\python26\lib\site-packages\django\template\loader.py", line
>>>>> 138, in find_template
>>>>>    raise TemplateDoesNotExist(name)
>>>>> django.template.base.TemplateDoesNotExist: base.html
>>>>>>>>
>>>>>>>> exit()
>>>>>
>>>>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
>>>>> site-packages/django/contrib/admin/templates/admin | grep base
>>>>> base.html
>>>>> base_site.html
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> "Django users" group.
>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> django-users+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> "Django users" group.
>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> django-users+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

On 10/31/2011 3:51 PM, Bill Freeman wrote:
> Try putting a comma at the end of the TEMPLATE_DIRS line.

Hurrah, that did it. Thanks Mr. Freeman.

> Parentheses do not the tuple make. It's the comma. An expression
> surrounded by parentheses is just the expression, so you're trying to
> use each letter of your setting as a directory, I believe.

I assumed a single directory could be a case of a single element. Tuple
lesson duly noted.

> I take it you're not using the app directories loader?

Not yet.

- Stefan

> On Mon, Oct 31, 2011 at 3:58 PM, Stefan Lisowski<s.lisowski@isti.com> wrote:
>> On 10/31/2011 2:49 PM, Bill Freeman wrote:
>>> I think that you have too many "admin"s. Try:
>>>
>>>
>>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates')
>>
>> Thanks for the suggestion. I don't see much difference on my system here
>> though...
>>
>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>c:\Python26\python.exe
>> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
>> on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import django.template
>>>>>
>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates'),TEMPLATE_DEBUG=True,
>>>>> DEBUG=True)
>>>>> import django.template.loader as loader
>>>>> loader.get_template("base.html")
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> File "c:\Python26\lib\site-packages\django\template\loader.py", line 157,
>> in get_template
>> template, origin = find_template(template_name)
>> File "c:\Python26\lib\site-packages\django\template\loader.py", line 138,
>> in find_template
>> raise TemplateDoesNotExist(name)
>> django.template.base.TemplateDoesNotExist: base.html
>>>>> loader.get_template("admin/base.html")
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> File "c:\Python26\lib\site-packages\django\template\loader.py", line 157,
>> in get_template
>> template, origin = find_template(template_name)
>> File "c:\Python26\lib\site-packages\django\template\loader.py", line 138,
>> in find_template
>> raise TemplateDoesNotExist(name)
>> django.template.base.TemplateDoesNotExist: admin/base.html
>>
>> Has anyone here used the template system successfully without using all of
>> Django?
>>
>>>
>>> On Mon, Oct 31, 2011 at 3:30 PM, Stefan Lisowski<s.lisowski@isti.com>
>>> wrote:
>>>>
>>>> I appreciate the reply SmileyChris -
>>>>
>>>> On 10/30/2011 12:41 PM, SmileyChris wrote:
>>>>>
>>>>> Take a read through this section of the docs:
>>>>>
>>>>> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates
>>>>
>>>> Yes, that's what I was reading.
>>>>
>>>>> Specifically, those templates are found via the app_directories.Loader.
>>>>> So you'd run loader.get_template('admin/base.html') to get that
>>>>> template. The reason that it's in a subdirectory is to avoid conflicts
>>>>> with other applications (since they may want to use their own
>>>>> 'base.html' template.
>>>>
>>>> So, my setting TEMPLATE_DIRS here to the actual subdirectory would not
>>>> work?
>>>>
>>>>
>>>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')
>>>>
>>>> I used this as an example to point to some templates that are known to
>>>> work,
>>>> rather than point to my own templates that don't work either. If I go
>>>> into
>>>> the Django code and print out the directory that's being searched, I see
>>>> the
>>>> correct directory there, so I don't know why things are failing. Maybe
>>>> I'm
>>>> just not instantiating things correctly?
>>>>
>>>> In any case, I tried your suggestion, but still no luck:
>>>>
>>>>>>> loader.get_template('admin/base.html')
>>>>
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in<module>
>>>> File "django/template/loader.py", line 164, in get_template
>>>> template, origin = find_template(template_name)
>>>> File "django/template/loader.py", line 145, in find_template
>>>> raise TemplateDoesNotExist(name)
>>>> django.template.base.TemplateDoesNotExist: admin/base.html
>>>>
>>>> (I also tried without manually setting TEMPLATE_DIRS, but just ran
>>>> django.conf.settings.configure(), still to no avail.)
>>>>
>>>> Anyone, any ideas? I'm completely new to Django, but I've not been
>>>> working
>>>> in Python lately either, so it could just be a Python mistake on my part.
>>>>
>>>> - Stefan
>>>>
>>>> -------- Original Message --------
>>>> Subject: Django Standalone Template
>>>> Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
>>>> From: Stefan Lisowski<s.lisowski@isti.com>
>>>> Reply-To: django-users@googlegroups.com
>>>> To: Django users<django-users@googlegroups.com>
>>>>
>>>> Hi Django folks -
>>>>
>>>> I'm new to Django, and I just want to use the template system now,
>>>> independent of the rest of Django. But I can't get it to see a
>>>> template. Even the system templates as was suggested when I started
>>>> Googling for my error.
>>>>
>>>>>>> import django.template
>>>>>>>
>>>>>>>
>>>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True,
>>>>>>> DEBUG=True)
>>>>>>> import django.template.loader as loader
>>>>>>> loader.get_template("base.html")
>>>>
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in<module>
>>>> File "c:\python26\lib\site-packages\django\template\loader.py", line
>>>> 157, in get_template
>>>> template, origin = find_template(template_name)
>>>> File "c:\python26\lib\site-packages\django\template\loader.py", line
>>>> 138, in find_template
>>>> raise TemplateDoesNotExist(name)
>>>> django.template.base.TemplateDoesNotExist: base.html
>>>>>>>
>>>>>>> exit()
>>>>
>>>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
>>>> site-packages/django/contrib/admin/templates/admin | grep base
>>>> base.html
>>>> base_site.html
>>>>
>>>> Any ideas?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Django users" group.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> django-users+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Django users" group.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> django-users+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

Try putting a comma at the end of the TEMPLATE_DIRS line.

Parentheses do not the tuple make. It's the comma. An expression
surrounded by parentheses is just the expression, so you're trying to
use each letter of your setting as a directory, I believe.

I take it you're not using the app directories loader?

On Mon, Oct 31, 2011 at 3:58 PM, Stefan Lisowski <s.lisowski@isti.com> wrote:
> On 10/31/2011 2:49 PM, Bill Freeman wrote:
>> I think that you have too many "admin"s.  Try:
>>
>>
>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates')
>
> Thanks for the suggestion. I don't see much difference on my system here
> though...
>
> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>c:\Python26\python.exe
> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
> on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import django.template
>>>>
>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates'),TEMPLATE_DEBUG=True,
>>>> DEBUG=True)
>>>> import django.template.loader as loader
>>>> loader.get_template("base.html")
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "c:\Python26\lib\site-packages\django\template\loader.py", line 157,
> in get_template
>    template, origin = find_template(template_name)
>  File "c:\Python26\lib\site-packages\django\template\loader.py", line 138,
> in find_template
>    raise TemplateDoesNotExist(name)
> django.template.base.TemplateDoesNotExist: base.html
>>>> loader.get_template("admin/base.html")
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "c:\Python26\lib\site-packages\django\template\loader.py", line 157,
> in get_template
>    template, origin = find_template(template_name)
>  File "c:\Python26\lib\site-packages\django\template\loader.py", line 138,
> in find_template
>    raise TemplateDoesNotExist(name)
> django.template.base.TemplateDoesNotExist: admin/base.html
>
> Has anyone here used the template system successfully without using all of
> Django?
>
>>
>> On Mon, Oct 31, 2011 at 3:30 PM, Stefan Lisowski<s.lisowski@isti.com>
>>  wrote:
>>>
>>> I appreciate the reply SmileyChris -
>>>
>>> On 10/30/2011 12:41 PM, SmileyChris wrote:
>>>>
>>>> Take a read through this section of the docs:
>>>>
>>>> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates
>>>
>>> Yes, that's what I was reading.
>>>
>>>> Specifically, those templates are found via the app_directories.Loader.
>>>> So you'd run loader.get_template('admin/base.html') to get that
>>>> template. The reason that it's in a subdirectory is to avoid conflicts
>>>> with other applications (since they may want to use their own
>>>> 'base.html' template.
>>>
>>> So, my setting TEMPLATE_DIRS here to the actual subdirectory would not
>>> work?
>>>
>>>
>>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')
>>>
>>> I used this as an example to point to some templates that are known to
>>> work,
>>> rather than point to my own templates that don't work either. If I go
>>> into
>>> the Django code and print out the directory that's being searched, I see
>>> the
>>> correct directory there, so I don't know why things are failing. Maybe
>>> I'm
>>> just not instantiating things correctly?
>>>
>>> In any case, I tried your suggestion, but still no luck:
>>>
>>>>>> loader.get_template('admin/base.html')
>>>
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in<module>
>>>  File "django/template/loader.py", line 164, in get_template
>>>    template, origin = find_template(template_name)
>>>  File "django/template/loader.py", line 145, in find_template
>>>    raise TemplateDoesNotExist(name)
>>> django.template.base.TemplateDoesNotExist: admin/base.html
>>>
>>> (I also tried without manually setting TEMPLATE_DIRS, but just ran
>>> django.conf.settings.configure(), still to no avail.)
>>>
>>> Anyone, any ideas? I'm completely new to Django, but I've not been
>>> working
>>> in Python lately either, so it could just be a Python mistake on my part.
>>>
>>> - Stefan
>>>
>>> -------- Original Message --------
>>> Subject: Django Standalone Template
>>> Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
>>> From: Stefan Lisowski<s.lisowski@isti.com>
>>> Reply-To: django-users@googlegroups.com
>>> To: Django users<django-users@googlegroups.com>
>>>
>>> Hi Django folks -
>>>
>>> I'm new to Django, and I just want to use the template system now,
>>> independent of the rest of Django. But I can't get it to see a
>>> template. Even the system templates as was suggested when I started
>>> Googling for my error.
>>>
>>>>>> import django.template
>>>>>>
>>>>>>
>>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True,
>>>>>> DEBUG=True)
>>>>>> import django.template.loader as loader
>>>>>> loader.get_template("base.html")
>>>
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in<module>
>>>  File "c:\python26\lib\site-packages\django\template\loader.py", line
>>> 157, in get_template
>>>    template, origin = find_template(template_name)
>>>  File "c:\python26\lib\site-packages\django\template\loader.py", line
>>> 138, in find_template
>>>    raise TemplateDoesNotExist(name)
>>> django.template.base.TemplateDoesNotExist: base.html
>>>>>>
>>>>>> exit()
>>>
>>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
>>> site-packages/django/contrib/admin/templates/admin | grep base
>>> base.html
>>> base_site.html
>>>
>>> Any ideas?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

On 10/31/2011 2:49 PM, Bill Freeman wrote:
> I think that you have too many "admin"s. Try:
>
>
TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates')

Thanks for the suggestion. I don't see much difference on my system here
though...

C:\Program Files (x86)\Microsoft Visual Studio 8\VC>c:\Python26\python.exe
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django.template
>>>
django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates'),TEMPLATE_DEBUG=True,
DEBUG=True)
>>> import django.template.loader as loader
>>> loader.get_template("base.html")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\site-packages\django\template\loader.py", line
157, in get_template
template, origin = find_template(template_name)
File "c:\Python26\lib\site-packages\django\template\loader.py", line
138, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: base.html
>>> loader.get_template("admin/base.html")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\site-packages\django\template\loader.py", line
157, in get_template
template, origin = find_template(template_name)
File "c:\Python26\lib\site-packages\django\template\loader.py", line
138, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: admin/base.html

Has anyone here used the template system successfully without using all
of Django?

>
> On Mon, Oct 31, 2011 at 3:30 PM, Stefan Lisowski<s.lisowski@isti.com> wrote:
>> I appreciate the reply SmileyChris -
>>
>> On 10/30/2011 12:41 PM, SmileyChris wrote:
>>>
>>> Take a read through this section of the docs:
>>> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates
>>
>> Yes, that's what I was reading.
>>
>>> Specifically, those templates are found via the app_directories.Loader.
>>> So you'd run loader.get_template('admin/base.html') to get that
>>> template. The reason that it's in a subdirectory is to avoid conflicts
>>> with other applications (since they may want to use their own
>>> 'base.html' template.
>>
>> So, my setting TEMPLATE_DIRS here to the actual subdirectory would not work?
>>
>> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')
>>
>> I used this as an example to point to some templates that are known to work,
>> rather than point to my own templates that don't work either. If I go into
>> the Django code and print out the directory that's being searched, I see the
>> correct directory there, so I don't know why things are failing. Maybe I'm
>> just not instantiating things correctly?
>>
>> In any case, I tried your suggestion, but still no luck:
>>
>>>>> loader.get_template('admin/base.html')
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> File "django/template/loader.py", line 164, in get_template
>> template, origin = find_template(template_name)
>> File "django/template/loader.py", line 145, in find_template
>> raise TemplateDoesNotExist(name)
>> django.template.base.TemplateDoesNotExist: admin/base.html
>>
>> (I also tried without manually setting TEMPLATE_DIRS, but just ran
>> django.conf.settings.configure(), still to no avail.)
>>
>> Anyone, any ideas? I'm completely new to Django, but I've not been working
>> in Python lately either, so it could just be a Python mistake on my part.
>>
>> - Stefan
>>
>> -------- Original Message --------
>> Subject: Django Standalone Template
>> Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
>> From: Stefan Lisowski<s.lisowski@isti.com>
>> Reply-To: django-users@googlegroups.com
>> To: Django users<django-users@googlegroups.com>
>>
>> Hi Django folks -
>>
>> I'm new to Django, and I just want to use the template system now,
>> independent of the rest of Django. But I can't get it to see a
>> template. Even the system templates as was suggested when I started
>> Googling for my error.
>>
>>>>> import django.template
>>>>>
>>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True,
>>>>> DEBUG=True)
>>>>> import django.template.loader as loader
>>>>> loader.get_template("base.html")
>>
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> File "c:\python26\lib\site-packages\django\template\loader.py", line
>> 157, in get_template
>> template, origin = find_template(template_name)
>> File "c:\python26\lib\site-packages\django\template\loader.py", line
>> 138, in find_template
>> raise TemplateDoesNotExist(name)
>> django.template.base.TemplateDoesNotExist: base.html
>>>>>
>>>>> exit()
>>
>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
>> site-packages/django/contrib/admin/templates/admin | grep base
>> base.html
>> base_site.html
>>
>> Any ideas?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

I think that you have too many "admin"s. Try:

TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates')

On Mon, Oct 31, 2011 at 3:30 PM, Stefan Lisowski <s.lisowski@isti.com> wrote:
> I appreciate the reply SmileyChris -
>
> On 10/30/2011 12:41 PM, SmileyChris wrote:
>>
>> Take a read through this section of the docs:
>> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates
>
> Yes, that's what I was reading.
>
>> Specifically, those templates are found via the app_directories.Loader.
>> So you'd run loader.get_template('admin/base.html') to get that
>> template. The reason that it's in a subdirectory is to avoid conflicts
>> with other applications (since they may want to use their own
>> 'base.html' template.
>
> So, my setting TEMPLATE_DIRS here to the actual subdirectory would not work?
>
> TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')
>
> I used this as an example to point to some templates that are known to work,
> rather than point to my own templates that don't work either. If I go into
> the Django code and print out the directory that's being searched, I see the
> correct directory there, so I don't know why things are failing. Maybe I'm
> just not instantiating things correctly?
>
> In any case, I tried your suggestion, but still no luck:
>
>>>> loader.get_template('admin/base.html')
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "django/template/loader.py", line 164, in get_template
>    template, origin = find_template(template_name)
>  File "django/template/loader.py", line 145, in find_template
>    raise TemplateDoesNotExist(name)
> django.template.base.TemplateDoesNotExist: admin/base.html
>
> (I also tried without manually setting TEMPLATE_DIRS, but just ran
> django.conf.settings.configure(), still to no avail.)
>
> Anyone, any ideas? I'm completely new to Django, but I've not been working
> in Python lately either, so it could just be a Python mistake on my part.
>
> - Stefan
>
> -------- Original Message --------
> Subject: Django Standalone Template
> Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
> From: Stefan Lisowski <s.lisowski@isti.com>
> Reply-To: django-users@googlegroups.com
> To: Django users <django-users@googlegroups.com>
>
> Hi Django folks -
>
> I'm new to Django, and I just want to use the template system now,
> independent of the rest of Django. But I can't get it to see a
> template. Even the system templates as was suggested when I started
> Googling for my error.
>
>>>> import django.template
>>>>
>>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True,
>>>> DEBUG=True)
>>>> import django.template.loader as loader
>>>> loader.get_template("base.html")
>
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "c:\python26\lib\site-packages\django\template\loader.py", line
> 157, in get_template
>    template, origin = find_template(template_name)
>  File "c:\python26\lib\site-packages\django\template\loader.py", line
> 138, in find_template
>    raise TemplateDoesNotExist(name)
> django.template.base.TemplateDoesNotExist: base.html
>>>>
>>>> exit()
>
> C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
> site-packages/django/contrib/admin/templates/admin | grep base
> base.html
> base_site.html
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Standalone Template

I appreciate the reply SmileyChris -

On 10/30/2011 12:41 PM, SmileyChris wrote:
> Take a read through this section of the docs:
> https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates

Yes, that's what I was reading.

> Specifically, those templates are found via the app_directories.Loader.
> So you'd run loader.get_template('admin/base.html') to get that
> template. The reason that it's in a subdirectory is to avoid conflicts
> with other applications (since they may want to use their own
> 'base.html' template.

So, my setting TEMPLATE_DIRS here to the actual subdirectory would not work?

TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin')

I used this as an example to point to some templates that are known to
work, rather than point to my own templates that don't work either. If I
go into the Django code and print out the directory that's being
searched, I see the correct directory there, so I don't know why things
are failing. Maybe I'm just not instantiating things correctly?

In any case, I tried your suggestion, but still no luck:

>>> loader.get_template('admin/base.html')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "django/template/loader.py", line 164, in get_template
template, origin = find_template(template_name)
File "django/template/loader.py", line 145, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: admin/base.html

(I also tried without manually setting TEMPLATE_DIRS, but just ran
django.conf.settings.configure(), still to no avail.)

Anyone, any ideas? I'm completely new to Django, but I've not been
working in Python lately either, so it could just be a Python mistake on
my part.

- Stefan

-------- Original Message --------
Subject: Django Standalone Template
Date: Fri, 28 Oct 2011 19:54:20 -0700 (PDT)
From: Stefan Lisowski <s.lisowski@isti.com>
Reply-To: django-users@googlegroups.com
To: Django users <django-users@googlegroups.com>

Hi Django folks -

I'm new to Django, and I just want to use the template system now,
independent of the rest of Django. But I can't get it to see a
template. Even the system templates as was suggested when I started
Googling for my error.

>>> import django.template
>>> django.conf.settings.configure(TEMPLATE_DIRS=('C:/Python26/Lib/site-packages/django/contrib/admin/templates/admin'),TEMPLATE_DEBUG=True, DEBUG=True)
>>> import django.template.loader as loader
>>> loader.get_template("base.html")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python26\lib\site-packages\django\template\loader.py", line
157, in get_template
template, origin = find_template(template_name)
File "c:\python26\lib\site-packages\django\template\loader.py", line
138, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: base.html
>>> exit()
C:\Program Files (x86)\Microsoft Visual Studio 8\VC>ls C:/Python26/Lib/
site-packages/django/contrib/admin/templates/admin | grep base
base.html
base_site.html

Any ideas?

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Dynamic URLs or creating querysets from your URL paths.

Sure you could do that. It's called using XML Transformations (XSLT), Javascript Templatating Engines, or a number of other approaches. 

Django does this with its Template Engine. The reason this isn't completely ran on the Client-Side is because it would be slower, difficult to cache, and dependent upon some specific Client-Side technologies.

Django lets you easily override this behavior. For example, there's documentation on using alternative Templating Engines. You could apply the same methodology to using Client-Side Templating Engines (written in Javascript), or even just displaying XML w/ XSLT using the Browser's Transformation Engine. I'm not really the most experienced person when it comes to Client-Side templates but I'm sure there's a lot out there in Google Land.

On Mon, Oct 31, 2011 at 1:04 PM, Timmy O'Mahony <t.omahony.dublin@gmail.com> wrote:
The more I think about this the more I realize that what I'm talking about IS exactly a REST api.

If I write a phone app, I will code all the presentation layer locally on the phone (client-side) and use json/xml to dynamically fetch data from the server. 

Why isn't this the same for websites? - why isn't the presentation layer completely client-side as opposed to 'a bit of both'?

Ideally when a user requests a webpage from my server, I should deliver the presentation layer to them, along with the information they require to perform an API lookup. From then on they can query my server using the same REST api a phone app would use. This would mean that all the information from EVERY device accessing my website comes from the same api. This is much better then my existing setup, where I might have an API for an app to accompany my site, but I also have a jungle of urls and views to enable a web browser use my site

Am I just repeating/realizing something that is well know and catered for? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/f1xLB5KuZQAJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Dynamic URLs or creating querysets from your URL paths.

The more I think about this the more I realize that what I'm talking about IS exactly a REST api.

If I write a phone app, I will code all the presentation layer locally on the phone (client-side) and use json/xml to dynamically fetch data from the server. 

Why isn't this the same for websites? - why isn't the presentation layer completely client-side as opposed to 'a bit of both'?

Ideally when a user requests a webpage from my server, I should deliver the presentation layer to them, along with the information they require to perform an API lookup. From then on they can query my server using the same REST api a phone app would use. This would mean that all the information from EVERY device accessing my website comes from the same api. This is much better then my existing setup, where I might have an API for an app to accompany my site, but I also have a jungle of urls and views to enable a web browser use my site

Am I just repeating/realizing something that is well know and catered for? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/f1xLB5KuZQAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Dynamic URLs or creating querysets from your URL paths.

I'm creating a CMS using django-cms and some custom plugins. Everytime I do this I get sick or writing the same views time and time again.

Quick example, I have a Project model that can have one or more Categories, Tags and Clients:

class Project(...)
    categories = models.ManyToManyField(Category)
    tags = models.ManyToManyField(Tag)
    clients = models.ManyToManyField(Client)

I want the user to be able to browse my projects by a certain category, or tag or client. So my urls would be something like:

url(r'^projects/category/(?P<slug>[-w]+)/$', ...
url(r'^projects/partner/(?P<slug>[-w]+)/$', ...
url(r'^projects/client/(?P<slug>[-w]+)/$', ...

allowing me to see all projects for particular relationships, and maybe

url(r'^projects/category/$', ...
url(r'^projects/partner/$', ...
url(r'^projects/client/$', ...

to list all categories, partners and clients. 

This seems totally anti-DRY (WET?) to me. I'd like to be able to dynamically create the query based on what the URL path is, instead of having to manually link the URL paths to the correct queries via views as it stands at the moment. So retrieve the correct model based on what path is supplied - somewhat like a REST API call. Does anyone have any thoughts on this approach, or Is there anything out there that caters for this? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PSZyTu0TRk4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Login problems under heavy load

On 24 October 2011 12:01, Tom Evans <tevans.uk@googlemail.com> wrote:
On Fri, Oct 21, 2011 at 6:15 PM, Alpesh Gajbe <alpeshgajbe@gmail.com> wrote:
>
>  File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py",
> line 296, in read
>   return self._stream.read(*args, **kwargs)
>
> IOError: request data read error
>

tl;dr - the user got bored waiting, pressed 'stop' on their browser.


Although that's almost always true, it *is* possible to see "request data read error" on WSGI that isn't caused by the user hitting stop. See for example the ModWSGI FAQ.

Malcolm 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django tutorial hasn't received an update for 1.3

Hi,

If you've figured this stuff out, how about writing some of the tutorial yourself and submitting a patch?

Trying to teach someone else is the best way to figure out if you really understand something, and you'd be contributing to keeping the Django documentation great.

Malcolm

On 31 October 2011 07:08, Kevin <kveroneau@gmail.com> wrote:
I keep checking the tutorial page for version 1.3 hoping to see some
new content related to the class-based views or at least some of the
promised future tutorials.  The tutorial still has the function-based
views, and no new updates since I first went through it on the 1.2
release.

I know the function views work in 1.3, but shouldn't the tutorial be
using the latest features included in 1.3 so that new users coming to
Django begin learning the newest features, such as class-based views.

I'm still a dinosaur and using Django 1.2 and haven't yet dived into
class-based views, and when I do, I would love a great tutorial on how
to proceed.  I plan on learning Django 1.3's newest features very soon
to keep myself up to speed and see if my current apps are fully
compatible.

Are there any updates on when we will see the following new tutorial
sections:
-    Advanced form processing
-    Using the RSS framework
-    Using the cache framework
-    Using the comments framework
-    Advanced admin features: Permissions
-    Advanced admin features: Custom JavaScript

I figured out most of this on my own, as they are pretty
straightforward, still haven't dived into custom javascript in the
admin yet.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
Malcolm Box
malcolm.box@gmail.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: variables in a dict in a template

On Mon, Oct 31, 2011 at 2:36 AM, kenneth gonsalves
<lawgon@thenilgiris.com> wrote:
> On Sun, 2011-10-30 at 12:00 -0400, Kurtis Mullins wrote:
>> One way to go about it is to create multiple, nested objects. For
>> example:
>>
>> Score - Rounds ---- Holes
>>
>> Then in your template, you'd do something along the lines of:
>>
>> {% for round in game.rounds %} {% for hole in round.holes %}
>> {{ hole.score }} {% endfor %} {% endfor%}
>>
>>
>> Hopefully that helps a little :)
>
> that was my original structure - but there was too much code required,
> and after several years of using it, I still found difficulty in
> understanding and upgrading it. The present structure is simple and
> flexible - the only downside is that I have write some extra html.
> Anyway it is just one template and I suppose I have to live with it.
> --
> regards
> Kenneth Gonsalves

When the going gets complicated, my simple mind reaches for python.
Maybe a custom template filter?

Bill

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: I can't activate the admin site

On 31/10/2011 02:12 μμ, kenneth gonsalves wrote:
>
> but the indentation error seems to be in the django source code?
> Normally one does not fiddle with that.
>

no I wouldn't expect the indentation problem to be located in django code.
unless you are using an unstable version or something....

--
--------------------------------------------------------------
Nick Apostolakis
e-mail: nickapos@oncrete.gr
Web Site: http://nick.oncrete.gr
--------------------------------------------------------------


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Why are my two django objects of the same type behaving differently?

Help!

I have two objects that i have created using different techniques in
django;

>>> from django.contrib.contenttypes.models import ContentType
>>> from myproject.models import Building

Method A

>>> content_type = ContentType.objects.get(app_label='myproject', model='Building')

>>> content_class = content_type.model_class()

>>> content_query = content_class.objects.raw("Select * from pms_building where name like '%build%' ")

>>> type(content_query)

<class 'django.db.models.query.RawQuerySet'>
>>> content_query[0]
# error ....
# Attribute: 'str' object has no attribute 'items'

Method B

>>> bld = Building.objects.raw("Select * from pms_building where name like '%build%' ")

>>> type(bld)

<class 'django.db.models.query.RawQuerySet'>

>>>bld[0]
<Building: Building A>

My question is why are the two objects of the same type behaving
differently?

Gath

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: django-easyfilters for filtering data in a view

If anyone else is having trouble here, my problem was in passing the
template when loaded from an external file--specifying the template
inline worked fine for me.

The context variables are provided in the documentation.


Good luck
-alan


On Oct 30, 9:21 pm, Alan <alan.ill...@gmail.com> wrote:
> I'm trying to put together a view that filters data similar to the
> admin interface's change lists for a model.
>
> Does anyone use django-easyfilters for this purpose?
>
> The documentation is very terse on how to use the get_template()
> method:http://packages.python.org/django-easyfilters/filterset.html
>
> I correctly return a template but I'm not sure how to provide the
> context data from the derived FilterSet class.
>
> Thanks
> -alan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Can't add superuser

Hi, I'm unable to add superuser. Running latest development trunk of
Django, & Python 2.7

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no): yes
Traceback (most recent call last):
File "./manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 422, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 361, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 351, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
sql.py", line 189, in emit_post_sync_signal
interactive=interactive, db=db)
File "/usr/local/lib/python2.7/site-packages/django/dispatch/
dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/
management/__init__.py", line 73, in create_superuser
call_command("createsuperuser", interactive=True)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 148, in call_command
return klass.execute(*args, **defaults)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/
management/commands/createsuperuser.py", line 63, in handle
default_username = get_default_username()
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/
management/__init__.py", line 105, in get_default_username
default_username = get_system_username()
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/
management/__init__.py", line 85, in get_system_username
return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None


Because of this, I can't use the admin app:
Site matching query does not exist.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.