Re: settings.py gets imported twice
Thomas Guettler wrote: > A found this solution. > > # file logconfig.py > import logging > if not hasattr(logging, "set_up_done"): > logging.set_up_done=False > > def set_up(myhome): > if logging.set_up_done: > return > logging.set_up_done=True > Here's an alternative solution - it's based on the idea that the handlers are added to the logger only once. (getLogger returns the same logger instance each time). import logging logger=logging.getLogger("dws") if not logger.handlers: ... logger.addHandler() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Get PK value in Field class after saving
Hi, I have a Field class for attachments and I would like to rename the attachment after upload. This class inherits from models.ImageField. The problem is that in field method save_file() and _save() all values pointing to ID are None. new_object['id'] is None and instance._get_pk_val() is None In which method is the ID available? Thanks in advance, Frank --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n model field not translated
its not working... isnt verbose_name is for meta class?.. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n model field not translated
Try this name= models.CharField(verbose_name=_('name'), help_text=_('This is the help text'), max_length = 255) On Nov 6, 9:51 am, otonk <[EMAIL PROTECTED]> wrote: > I did.. > > from django.db import models > from django.utils.translation import ugettext_lazy as _ > --- code emmited --- > > name= models.CharField(_('name'), help_text=_('This is the > help text'), max_length = 255) > > --- code emmited --- > > on the above code, the > [ help_text=_('This is the help text') ] > is translated.. however the _('name') is not --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n model field not translated
I did.. from django.db import models from django.utils.translation import ugettext_lazy as _ --- code emmited --- name= models.CharField(_('name'), help_text=_('This is the help text'), max_length = 255) --- code emmited --- on the above code, the [ help_text=_('This is the help text') ] is translated.. however the _('name') is not --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n model field not translated
Hi otonk Use ugettex_lazy form models from django.utils.translation import ugettext_lazy as _ cschand On Nov 6, 9:15 am, otonk <[EMAIL PROTECTED]> wrote: > Hi, I am working on a multilingual project, mainly in indonesia and > english. > i tried to do i18n on my model fields but i cant get it work on the > admin site. > the model name is translated, however the fields name is not. > > here's my model.py > > class Company(models.Model): > name= models.CharField(_('name'), help_text=_('This is the > help text'), max_length = 255) > logo= models.ImageField(_('logo'), upload_to = 'logo/%Y%m%d > %H%M%S') > detail = models.TextField(_('detail'), blank = True) > letterhead = models.ImageField(_('letterhead'), upload_to = 'logo/ > %Y%m%d%H%M%S', blank = True) > > class Admin: > pass > fields = ( > (None,{ > 'fields': ('name','logo','detail') > }), > ('Optional', { > 'classes' : 'collapse', > 'fields' : ('letterhead',) > }), > ) > > class Meta: > verbose_name= _('Company') > verbose_name_plural = _('Companies') > > def __unicode__(self): > return '%s' % self.name > > as you can see the field 'name', the help_text is translated, but the > 'name' itself is not translated. > did i do something wrong? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
i18n model field not translated
Hi, I am working on a multilingual project, mainly in indonesia and english. i tried to do i18n on my model fields but i cant get it work on the admin site. the model name is translated, however the fields name is not. here's my model.py class Company(models.Model): name= models.CharField(_('name'), help_text=_('This is the help text'), max_length = 255) logo= models.ImageField(_('logo'), upload_to = 'logo/%Y%m%d %H%M%S') detail = models.TextField(_('detail'), blank = True) letterhead = models.ImageField(_('letterhead'), upload_to = 'logo/ %Y%m%d%H%M%S', blank = True) class Admin: pass fields = ( (None,{ 'fields': ('name','logo','detail') }), ('Optional', { 'classes' : 'collapse', 'fields' : ('letterhead',) }), ) class Meta: verbose_name= _('Company') verbose_name_plural = _('Companies') def __unicode__(self): return '%s' % self.name as you can see the field 'name', the help_text is translated, but the 'name' itself is not translated. did i do something wrong? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Custom SQL to delete cache table
Hi all, I'm trying to clear the cache table. Here's the code I'm using with Python 2.5 and Django version 0.96: def clear_cache(): from django.db import connection cursor = connection.cursor() cursor.execute("DELETE FROM django_cache WHERE 1=1") This is for the a SQLite3 backend, but it doesn't seem to work. I tried executing it in the command line and the table still doesn't clear. Is there something obvious I'm missing? - Hugh --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
will this hit database more than once by using AUTH_PROFILE_MODULE = 'myuser.MyUser'
you know django-registration is a famous module(http://code.google.com/ p/django-registration/). i have a topic want to discuss with all: there is a option in django-registration : AUTH_PROFILE_MODULE = 'myuser.MyUser' which can be setted in settings.py, so you can access value of MyUser by get_profile.xxx. my topic is, if MyUser have serveral field , to access these filed like this in the templates: Method 1: {{ myuser.get_profile.field1 }}, {{ myuser.get_profile.field2 }}, {{ myuser.get_profile.field3 }}, Method 2: myuser=MyUser.objects.get(.) then use: {{ myuser.field1 }}, {{ myuser.field2 }}, {{ myuser.field3 }}, does this mean we hit database 3 times in method 1? hit once in method 2 ? just a disscussion, thanks author of django-registration! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Strange UnicodeDecodeError in template
It would appear the Django template code is actually trying to raise a VariableDoesNotExist error, and tripping up on attempting to render a context that contains non-ASCII data. I don't know the correct fix for that, but as a temporary fix if you change line 130 of your /usr/local/lib/python2.5/site-packages/django/template/__init__.py (currently "return self.msg % self.params") to something like: return 'Variable does not exist: %s' % self.params[0] You should at least get an error pinpointing the variable your template is accessing that does not exist and where it is trying to be used instead of the UnicodeDecodeError, so you might be able to make progress on getting your own template/code to work. Karen On 11/5/07, Mikkel Høgh <[EMAIL PROTECTED]> wrote: > > > I have a bit of a problem with a project I'm creating. I get an > UnicodeDecodeError from some of the template code. The traceback is > here: > http://dpaste.com/24285/ > > It tries to decode the title field from unicode into ascii, but I > cannot seem to understand why... > I have dpaste'd the code in question. > > Template: http://dpaste.com/24284/ > Model (where the get_task function is): http://dpaste.com/24281/ > View (I suppose that's rather irrelevant): http://dpaste.com/24286/ > > Since the code is open source, you can browse it in its entirety here: > http://codebrowse.launchpad.net/~mikl/kaplan/kaplan.dev/files > > If anyone can figure this out, you will have my eternal gratitude > Thanks to Magus- in #django for trying - if you are reading this, I > changed the part you pointed out to use Django's slugify function > instead of str().lower(), but that wasn't it, sadly. > > Kind regards, > Mikkel Høgh > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Thanks a lot graham You have really helped me a lo. Thank you once againCan you please add me in Yahoo messenger id: aparichitudu_stranger Thank you On Nov 5, 3:33 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Turn off SELinux extensions on your box or do whatever research is > required to work out how to configure SELinux to allow the user that > Apache runs as to access your files. > > I can't help you with SELinux. > > Graham > > On Nov 6, 10:28 am, stranger <[EMAIL PROTECTED]> wrote: > > > Ya I have run the command and restarted Apache... I have found the > > cause for the problem can you advise me after looking at this > > screenshot. > > >http://img210.imageshack.us/img210/559/screenshot1bs5.png > > > On Nov 5, 3:24 pm, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > Run: > > > > chmod 0755 /home/priya > > > > Restart Apache for good measure and try again. > > > > As I originally said, all the directories down to the mysite directory > > > have to be readable and searchable to others. This means you personal > > > home directory as well. > > > > Graham > > > > On Nov 6, 10:20 am, stranger <[EMAIL PROTECTED]> wrote: > > > > > Sorry for deleting I have run the command in /home > > > > > When I run ls -lasgd in /home/priya > > > > 8 drwx-- 32 priya 4096 2007-11-05 14:54 . > > > > > When I run ls -las in /home/priya > > > > [EMAIL PROTECTED] ~]$ ls -las > > > > total 416 > > > > 8 drwx-- 32 priya priya 4096 2007-11-05 14:54 . > > > > 8 drwxr-xr-x 3 root root 4096 2007-11-04 02:20 .. > > > > 8 drwxrwxr-x 4 priya priya 4096 2007-11-04 16:39 .adobe > > > > 8 -rw--- 1 priya priya 1876 2007-11-05 14:30 .bash_history > > > > 8 -rw-r--r-- 1 priya priya33 2007-02-12 07:18 .bash_logout > > > > 8 -rw-r--r-- 1 priya priya 176 2007-02-12 07:18 .bash_profile > > > > 8 -rw-r--r-- 1 priya priya 124 2007-02-12 07:18 .bashrc > > > > 8 drwxr-xr-x 4 priya priya 4096 2007-11-04 15:36 .config > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-05 13:17 Desktop > > > > 8 -rw--- 1 priya priya26 2007-11-04 02:21 .dmrc > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Documents > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Download > > > > 8 drwxrwxr-x 8 priya priya 4096 2007-11-04 11:11 .evolution > > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 13:22 .fontconfig > > > > 8 drwx-- 4 priya priya 4096 2007-11-05 12:07 .gconf > > > > 8 drwx-- 2 priya priya 4096 2007-11-05 14:54 .gconfd > > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .gnome > > > > 8 drwx-- 9 priya priya 4096 2007-11-05 12:03 .gnome2 > > > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .gnome2_private > > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 01:15 .gstreamer-0.10 > > > > 8 -rw-rw-r-- 1 priya priya 136 2007-11-05 12:07 .gtk-bookmarks > > > > 8 -rw-r--r-- 1 priya priya87 2007-11-04 02:21 .gtkrc-1.2-gnome2 > > > > 8 -rw--- 1 priya priya 344 2007-11-05 12:07 .ICEauthority > > > > 8 -rw--- 1 priya priya35 2007-11-05 14:54 .lesshst > > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 15:36 .local > > > > 8 drwx-- 3 priya priya 4096 2007-11-04 11:06 .macromedia > > > > 8 -rw-rw-r-- 1 priya priya 3098 2007-11-04 16:37 .mailcap > > > > 8 drwx-- 3 priya priya 4096 2007-11-04 02:21 .metacity > > > > 8 drwx-- 3 priya priya 4096 2007-11-04 00:24 .mozilla > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Music > > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-05 14:27 mysite > > > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-05 12:03 .nautilus > > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 12:37 .openoffice.org2.0 > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Pictures > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Public > > > > 8 drwx-- 6 priya priya 4096 2007-11-04 11:57 .purple > > > > 40 -rw-rw-r-- 1 priya priya 34558 2007-11-04 16:37 .realplayerrc > > > > 8 -rw--- 1 priya priya 274 2007-11-05 14:19 .recently-used > > > > 16 -rw-rw-r-- 1 priya priya 11988 2007-11-05 14:19 .recently- > > > > used.xbel > > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .redhat > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Templates > > > > 8 drwx-- 3 priya priya 4096 2007-11-04 10:17 .thumbnails > > > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .Trash > > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Videos > > > > 8 -rw--- 1 priya priya 814 2007-11-05 14:23 .viminfo > > > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-04 18:33 .vlc > > > > 8 -rw-r--r-- 1 priya priya 878 2007-11-05 14:22 .xsession-errors > > > > [EMAIL PROTECTED] ~]$ > > > > > On Nov 5, 3:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> > > > > wrote: > > > > > > Please do not keep deleting the previous message content. It makes it > > > > > really hard having to go back and forth between
Re: mod_python: problem with http.conf
Hey I have set the SELINUX from enforcing to permissive and the localhost/mysite is working. I am getting the Django default page. On Nov 5, 3:28 pm, stranger <[EMAIL PROTECTED]> wrote: > Ya I have run the command and restarted Apache... I have found the > cause for the problem can you advise me after looking at this > screenshot. > > http://img210.imageshack.us/img210/559/screenshot1bs5.png > > On Nov 5, 3:24 pm, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > Run: > > > chmod 0755 /home/priya > > > Restart Apache for good measure and try again. > > > As I originally said, all the directories down to the mysite directory > > have to be readable and searchable to others. This means you personal > > home directory as well. > > > Graham > > > On Nov 6, 10:20 am, stranger <[EMAIL PROTECTED]> wrote: > > > > Sorry for deleting I have run the command in /home > > > > When I run ls -lasgd in /home/priya > > > 8 drwx-- 32 priya 4096 2007-11-05 14:54 . > > > > When I run ls -las in /home/priya > > > [EMAIL PROTECTED] ~]$ ls -las > > > total 416 > > > 8 drwx-- 32 priya priya 4096 2007-11-05 14:54 . > > > 8 drwxr-xr-x 3 root root 4096 2007-11-04 02:20 .. > > > 8 drwxrwxr-x 4 priya priya 4096 2007-11-04 16:39 .adobe > > > 8 -rw--- 1 priya priya 1876 2007-11-05 14:30 .bash_history > > > 8 -rw-r--r-- 1 priya priya33 2007-02-12 07:18 .bash_logout > > > 8 -rw-r--r-- 1 priya priya 176 2007-02-12 07:18 .bash_profile > > > 8 -rw-r--r-- 1 priya priya 124 2007-02-12 07:18 .bashrc > > > 8 drwxr-xr-x 4 priya priya 4096 2007-11-04 15:36 .config > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-05 13:17 Desktop > > > 8 -rw--- 1 priya priya26 2007-11-04 02:21 .dmrc > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Documents > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Download > > > 8 drwxrwxr-x 8 priya priya 4096 2007-11-04 11:11 .evolution > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 13:22 .fontconfig > > > 8 drwx-- 4 priya priya 4096 2007-11-05 12:07 .gconf > > > 8 drwx-- 2 priya priya 4096 2007-11-05 14:54 .gconfd > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .gnome > > > 8 drwx-- 9 priya priya 4096 2007-11-05 12:03 .gnome2 > > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .gnome2_private > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 01:15 .gstreamer-0.10 > > > 8 -rw-rw-r-- 1 priya priya 136 2007-11-05 12:07 .gtk-bookmarks > > > 8 -rw-r--r-- 1 priya priya87 2007-11-04 02:21 .gtkrc-1.2-gnome2 > > > 8 -rw--- 1 priya priya 344 2007-11-05 12:07 .ICEauthority > > > 8 -rw--- 1 priya priya35 2007-11-05 14:54 .lesshst > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 15:36 .local > > > 8 drwx-- 3 priya priya 4096 2007-11-04 11:06 .macromedia > > > 8 -rw-rw-r-- 1 priya priya 3098 2007-11-04 16:37 .mailcap > > > 8 drwx-- 3 priya priya 4096 2007-11-04 02:21 .metacity > > > 8 drwx-- 3 priya priya 4096 2007-11-04 00:24 .mozilla > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Music > > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-05 14:27 mysite > > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-05 12:03 .nautilus > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 12:37 .openoffice.org2.0 > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Pictures > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Public > > > 8 drwx-- 6 priya priya 4096 2007-11-04 11:57 .purple > > > 40 -rw-rw-r-- 1 priya priya 34558 2007-11-04 16:37 .realplayerrc > > > 8 -rw--- 1 priya priya 274 2007-11-05 14:19 .recently-used > > > 16 -rw-rw-r-- 1 priya priya 11988 2007-11-05 14:19 .recently- > > > used.xbel > > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .redhat > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Templates > > > 8 drwx-- 3 priya priya 4096 2007-11-04 10:17 .thumbnails > > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .Trash > > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Videos > > > 8 -rw--- 1 priya priya 814 2007-11-05 14:23 .viminfo > > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-04 18:33 .vlc > > > 8 -rw-r--r-- 1 priya priya 878 2007-11-05 14:22 .xsession-errors > > > [EMAIL PROTECTED] ~]$ > > > > On Nov 5, 3:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> > > > wrote: > > > > > Please do not keep deleting the previous message content. It makes it > > > > really hard having to go back and forth between messages. > > > > > On Nov 6, 10:11 am, stranger <[EMAIL PROTECTED]> wrote: > > > > > > I get this: > > > > > > 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . > > > > > If you get this when running that command in your home directory, ie., > > > > in > > > > > /home/priya > > > > > then you have well and truly mucked up ownership of files on your box > > > > as your home directory shouldn't be owned by root. > > > > > Do you want to try again? > > > > > This time try:
Re: mod_python: problem with http.conf
Ya I have run the command and restarted Apache... I have found the cause for the problem can you advise me after looking at this screenshot. http://img210.imageshack.us/img210/559/screenshot1bs5.png On Nov 5, 3:24 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Run: > > chmod 0755 /home/priya > > Restart Apache for good measure and try again. > > As I originally said, all the directories down to the mysite directory > have to be readable and searchable to others. This means you personal > home directory as well. > > Graham > > On Nov 6, 10:20 am, stranger <[EMAIL PROTECTED]> wrote: > > > Sorry for deleting I have run the command in /home > > > When I run ls -lasgd in /home/priya > > 8 drwx-- 32 priya 4096 2007-11-05 14:54 . > > > When I run ls -las in /home/priya > > [EMAIL PROTECTED] ~]$ ls -las > > total 416 > > 8 drwx-- 32 priya priya 4096 2007-11-05 14:54 . > > 8 drwxr-xr-x 3 root root 4096 2007-11-04 02:20 .. > > 8 drwxrwxr-x 4 priya priya 4096 2007-11-04 16:39 .adobe > > 8 -rw--- 1 priya priya 1876 2007-11-05 14:30 .bash_history > > 8 -rw-r--r-- 1 priya priya33 2007-02-12 07:18 .bash_logout > > 8 -rw-r--r-- 1 priya priya 176 2007-02-12 07:18 .bash_profile > > 8 -rw-r--r-- 1 priya priya 124 2007-02-12 07:18 .bashrc > > 8 drwxr-xr-x 4 priya priya 4096 2007-11-04 15:36 .config > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-05 13:17 Desktop > > 8 -rw--- 1 priya priya26 2007-11-04 02:21 .dmrc > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Documents > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Download > > 8 drwxrwxr-x 8 priya priya 4096 2007-11-04 11:11 .evolution > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 13:22 .fontconfig > > 8 drwx-- 4 priya priya 4096 2007-11-05 12:07 .gconf > > 8 drwx-- 2 priya priya 4096 2007-11-05 14:54 .gconfd > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .gnome > > 8 drwx-- 9 priya priya 4096 2007-11-05 12:03 .gnome2 > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .gnome2_private > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 01:15 .gstreamer-0.10 > > 8 -rw-rw-r-- 1 priya priya 136 2007-11-05 12:07 .gtk-bookmarks > > 8 -rw-r--r-- 1 priya priya87 2007-11-04 02:21 .gtkrc-1.2-gnome2 > > 8 -rw--- 1 priya priya 344 2007-11-05 12:07 .ICEauthority > > 8 -rw--- 1 priya priya35 2007-11-05 14:54 .lesshst > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 15:36 .local > > 8 drwx-- 3 priya priya 4096 2007-11-04 11:06 .macromedia > > 8 -rw-rw-r-- 1 priya priya 3098 2007-11-04 16:37 .mailcap > > 8 drwx-- 3 priya priya 4096 2007-11-04 02:21 .metacity > > 8 drwx-- 3 priya priya 4096 2007-11-04 00:24 .mozilla > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Music > > 8 drwxrwxr-x 2 priya priya 4096 2007-11-05 14:27 mysite > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-05 12:03 .nautilus > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 12:37 .openoffice.org2.0 > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Pictures > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Public > > 8 drwx-- 6 priya priya 4096 2007-11-04 11:57 .purple > > 40 -rw-rw-r-- 1 priya priya 34558 2007-11-04 16:37 .realplayerrc > > 8 -rw--- 1 priya priya 274 2007-11-05 14:19 .recently-used > > 16 -rw-rw-r-- 1 priya priya 11988 2007-11-05 14:19 .recently- > > used.xbel > > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .redhat > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Templates > > 8 drwx-- 3 priya priya 4096 2007-11-04 10:17 .thumbnails > > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .Trash > > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Videos > > 8 -rw--- 1 priya priya 814 2007-11-05 14:23 .viminfo > > 8 drwxr-xr-x 3 priya priya 4096 2007-11-04 18:33 .vlc > > 8 -rw-r--r-- 1 priya priya 878 2007-11-05 14:22 .xsession-errors > > [EMAIL PROTECTED] ~]$ > > > On Nov 5, 3:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > Please do not keep deleting the previous message content. It makes it > > > really hard having to go back and forth between messages. > > > > On Nov 6, 10:11 am, stranger <[EMAIL PROTECTED]> wrote: > > > > > I get this: > > > > > 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . > > > > If you get this when running that command in your home directory, ie., > > > in > > > > /home/priya > > > > then you have well and truly mucked up ownership of files on your box > > > as your home directory shouldn't be owned by root. > > > > Do you want to try again? > > > > This time try: > > > > cd /home/priya > > > ls -las > > > > Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options,
Re: mod_python: problem with http.conf
Run: chmod 0755 /home/priya Restart Apache for good measure and try again. As I originally said, all the directories down to the mysite directory have to be readable and searchable to others. This means you personal home directory as well. Graham On Nov 6, 10:20 am, stranger <[EMAIL PROTECTED]> wrote: > Sorry for deleting I have run the command in /home > > When I run ls -lasgd in /home/priya > 8 drwx-- 32 priya 4096 2007-11-05 14:54 . > > When I run ls -las in /home/priya > [EMAIL PROTECTED] ~]$ ls -las > total 416 > 8 drwx-- 32 priya priya 4096 2007-11-05 14:54 . > 8 drwxr-xr-x 3 root root 4096 2007-11-04 02:20 .. > 8 drwxrwxr-x 4 priya priya 4096 2007-11-04 16:39 .adobe > 8 -rw--- 1 priya priya 1876 2007-11-05 14:30 .bash_history > 8 -rw-r--r-- 1 priya priya33 2007-02-12 07:18 .bash_logout > 8 -rw-r--r-- 1 priya priya 176 2007-02-12 07:18 .bash_profile > 8 -rw-r--r-- 1 priya priya 124 2007-02-12 07:18 .bashrc > 8 drwxr-xr-x 4 priya priya 4096 2007-11-04 15:36 .config > 8 drwxr-xr-x 2 priya priya 4096 2007-11-05 13:17 Desktop > 8 -rw--- 1 priya priya26 2007-11-04 02:21 .dmrc > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Documents > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Download > 8 drwxrwxr-x 8 priya priya 4096 2007-11-04 11:11 .evolution > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 13:22 .fontconfig > 8 drwx-- 4 priya priya 4096 2007-11-05 12:07 .gconf > 8 drwx-- 2 priya priya 4096 2007-11-05 14:54 .gconfd > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .gnome > 8 drwx-- 9 priya priya 4096 2007-11-05 12:03 .gnome2 > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .gnome2_private > 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 01:15 .gstreamer-0.10 > 8 -rw-rw-r-- 1 priya priya 136 2007-11-05 12:07 .gtk-bookmarks > 8 -rw-r--r-- 1 priya priya87 2007-11-04 02:21 .gtkrc-1.2-gnome2 > 8 -rw--- 1 priya priya 344 2007-11-05 12:07 .ICEauthority > 8 -rw--- 1 priya priya35 2007-11-05 14:54 .lesshst > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 15:36 .local > 8 drwx-- 3 priya priya 4096 2007-11-04 11:06 .macromedia > 8 -rw-rw-r-- 1 priya priya 3098 2007-11-04 16:37 .mailcap > 8 drwx-- 3 priya priya 4096 2007-11-04 02:21 .metacity > 8 drwx-- 3 priya priya 4096 2007-11-04 00:24 .mozilla > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Music > 8 drwxrwxr-x 2 priya priya 4096 2007-11-05 14:27 mysite > 8 drwxr-xr-x 3 priya priya 4096 2007-11-05 12:03 .nautilus > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 12:37 .openoffice.org2.0 > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Pictures > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Public > 8 drwx-- 6 priya priya 4096 2007-11-04 11:57 .purple > 40 -rw-rw-r-- 1 priya priya 34558 2007-11-04 16:37 .realplayerrc > 8 -rw--- 1 priya priya 274 2007-11-05 14:19 .recently-used > 16 -rw-rw-r-- 1 priya priya 11988 2007-11-05 14:19 .recently- > used.xbel > 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .redhat > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Templates > 8 drwx-- 3 priya priya 4096 2007-11-04 10:17 .thumbnails > 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .Trash > 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Videos > 8 -rw--- 1 priya priya 814 2007-11-05 14:23 .viminfo > 8 drwxr-xr-x 3 priya priya 4096 2007-11-04 18:33 .vlc > 8 -rw-r--r-- 1 priya priya 878 2007-11-05 14:22 .xsession-errors > [EMAIL PROTECTED] ~]$ > > On Nov 5, 3:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > Please do not keep deleting the previous message content. It makes it > > really hard having to go back and forth between messages. > > > On Nov 6, 10:11 am, stranger <[EMAIL PROTECTED]> wrote: > > > > I get this: > > > > 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . > > > If you get this when running that command in your home directory, ie., > > in > > > /home/priya > > > then you have well and truly mucked up ownership of files on your box > > as your home directory shouldn't be owned by root. > > > Do you want to try again? > > > This time try: > > > cd /home/priya > > ls -las > > > Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Sorry for deleting I have run the command in /home When I run ls -lasgd in /home/priya 8 drwx-- 32 priya 4096 2007-11-05 14:54 . When I run ls -las in /home/priya [EMAIL PROTECTED] ~]$ ls -las total 416 8 drwx-- 32 priya priya 4096 2007-11-05 14:54 . 8 drwxr-xr-x 3 root root 4096 2007-11-04 02:20 .. 8 drwxrwxr-x 4 priya priya 4096 2007-11-04 16:39 .adobe 8 -rw--- 1 priya priya 1876 2007-11-05 14:30 .bash_history 8 -rw-r--r-- 1 priya priya33 2007-02-12 07:18 .bash_logout 8 -rw-r--r-- 1 priya priya 176 2007-02-12 07:18 .bash_profile 8 -rw-r--r-- 1 priya priya 124 2007-02-12 07:18 .bashrc 8 drwxr-xr-x 4 priya priya 4096 2007-11-04 15:36 .config 8 drwxr-xr-x 2 priya priya 4096 2007-11-05 13:17 Desktop 8 -rw--- 1 priya priya26 2007-11-04 02:21 .dmrc 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Documents 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Download 8 drwxrwxr-x 8 priya priya 4096 2007-11-04 11:11 .evolution 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 13:22 .fontconfig 8 drwx-- 4 priya priya 4096 2007-11-05 12:07 .gconf 8 drwx-- 2 priya priya 4096 2007-11-05 14:54 .gconfd 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .gnome 8 drwx-- 9 priya priya 4096 2007-11-05 12:03 .gnome2 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .gnome2_private 8 drwxrwxr-x 2 priya priya 4096 2007-11-04 01:15 .gstreamer-0.10 8 -rw-rw-r-- 1 priya priya 136 2007-11-05 12:07 .gtk-bookmarks 8 -rw-r--r-- 1 priya priya87 2007-11-04 02:21 .gtkrc-1.2-gnome2 8 -rw--- 1 priya priya 344 2007-11-05 12:07 .ICEauthority 8 -rw--- 1 priya priya35 2007-11-05 14:54 .lesshst 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 15:36 .local 8 drwx-- 3 priya priya 4096 2007-11-04 11:06 .macromedia 8 -rw-rw-r-- 1 priya priya 3098 2007-11-04 16:37 .mailcap 8 drwx-- 3 priya priya 4096 2007-11-04 02:21 .metacity 8 drwx-- 3 priya priya 4096 2007-11-04 00:24 .mozilla 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Music 8 drwxrwxr-x 2 priya priya 4096 2007-11-05 14:27 mysite 8 drwxr-xr-x 3 priya priya 4096 2007-11-05 12:03 .nautilus 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 12:37 .openoffice.org2.0 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Pictures 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Public 8 drwx-- 6 priya priya 4096 2007-11-04 11:57 .purple 40 -rw-rw-r-- 1 priya priya 34558 2007-11-04 16:37 .realplayerrc 8 -rw--- 1 priya priya 274 2007-11-05 14:19 .recently-used 16 -rw-rw-r-- 1 priya priya 11988 2007-11-05 14:19 .recently- used.xbel 8 drwxrwxr-x 3 priya priya 4096 2007-11-04 02:21 .redhat 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Templates 8 drwx-- 3 priya priya 4096 2007-11-04 10:17 .thumbnails 8 drwx-- 2 priya priya 4096 2007-11-04 02:21 .Trash 8 drwxr-xr-x 2 priya priya 4096 2007-11-04 02:21 Videos 8 -rw--- 1 priya priya 814 2007-11-05 14:23 .viminfo 8 drwxr-xr-x 3 priya priya 4096 2007-11-04 18:33 .vlc 8 -rw-r--r-- 1 priya priya 878 2007-11-05 14:22 .xsession-errors [EMAIL PROTECTED] ~]$ On Nov 5, 3:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Please do not keep deleting the previous message content. It makes it > really hard having to go back and forth between messages. > > On Nov 6, 10:11 am, stranger <[EMAIL PROTECTED]> wrote: > > > I get this: > > > 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . > > If you get this when running that command in your home directory, ie., > in > > /home/priya > > then you have well and truly mucked up ownership of files on your box > as your home directory shouldn't be owned by root. > > Do you want to try again? > > This time try: > > cd /home/priya > ls -las > > Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Please do not keep deleting the previous message content. It makes it really hard having to go back and forth between messages. On Nov 6, 10:11 am, stranger <[EMAIL PROTECTED]> wrote: > I get this: > > 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . If you get this when running that command in your home directory, ie., in /home/priya then you have well and truly mucked up ownership of files on your box as your home directory shouldn't be owned by root. Do you want to try again? This time try: cd /home/priya ls -las Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
I get this: 8 drwxr-xr-x 3 root 4096 2007-11-04 02:20 . --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
On Nov 6, 9:57 am, stranger <[EMAIL PROTECTED]> wrote: > Thank alot Graham. To which user, I must grant access? > > I know the command chmod.. and I traversed to mysite directory and > chmod -R 755 * > > still no change. Hmmm, I saw that example in the document I referred to and thought it was a bad example. For that reason I said in my post what permissions you should be aiming for. My initial thought of warning you not to use that example from the document was probably right. I thought perhaps though you would read the document well so you understood what it mean rather than just cutting and pasting some example that may work. Anyway, no major harm, it just means you have made a whole bunch of files executable when they don't need to be. Although, if you ran this command in your home directory you could have created various problems for yourself in the future. Now, in what directory did you run this command? In your home directory what do you get if you run: ls -lasgd . Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Thank alot Graham. To which user, I must grant access? I know the command chmod.. and I traversed to mysite directory and chmod -R 755 * still no change. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
On Nov 6, 9:37 am, stranger <[EMAIL PROTECTED]> wrote: > Yes my settings.py file is in the place you specified. > > I have restarted the apache: /etc/init.d/httpd restart > > I think u r right. Apache dont have right to read that module. Please > specify me how to give access to apche to my mysite directory. You need to use the 'chmod' command. If you don't know what this is for and how it works, I suggest you read through: http://www.unixgeeks.org/security/newbie/unix/man9/chmod.html and learn about it. In the end you will need 'o+rx' on directories, and 'o+r' on files, but read about chmod to learn what that means first. Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Yes my settings.py file is in the place you specified. I have restarted the apache: /etc/init.d/httpd restart I think u r right. Apache dont have right to read that module. Please specify me how to give access to apche to my mysite directory. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Hello Graham, Just followed the same instructions as u said. SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "['/home/priya'] + sys.path" No Change in http:localhost/mysite Still pointing to the same error page. EnvironmentError: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Send Big File Free and Easy Apply For FREE!!! ( New Service From yousendit FREE )
*Send Big File Free and Easy* Send, Receive and Track files with YouSendIt. apply for free. be urgent , there is the time limits. http://pinurl.com/3z4 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Are the admin site templates cached?
Update to myself... I've still not got anywhere fixing this but I was wrong before about other templates in that directory (e.g. 404.html) working - the 404 file shown was the site wide 404 message. So no admin templates can be loaded. Non admin templates (for the views) work fine. Thanks, Ben --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
On Nov 6, 9:13 am, stranger <[EMAIL PROTECTED]> wrote: > Thank you Graham for the fast reply Could you please elaborate a > little since i am new to django. > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonDebug On > > ...and replace mysite.settings with the Python import path to your > Django project's settings file. > > So how to know Python import path to Django project settings file. As per exact example in the documentation, something like: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "['/path/to/project'] + sys.path" Just replace '/path/to/project' with the parent directory of where 'mysite' project directory is, which in your case seems to be '/home/ priya'. Just try to do what the documentation says to do. Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django Threaded Fastcgi Safe?
The latest roundup on thread safety of Django is that although it was not designed for thread safety initially, the only known multithreading problem has been fixed some time back. As such, numerous people do run it in Apache worker MPM for UNIX and on winnt MPM on Windows, both of which are multithreaded. The Django instructions even show using multithreaded mode with FASTCGI, so that it is present must mean people are having success with it also. The important thing though is whether your own application code built on top of Django is itself thread. You would therefore need to ensure you test you code properly. Using mod_wsgi is another option and perhaps simpler to configure and manage than FASTCGI solutions, especially if the later requires a separate supervisor system to startup your FASTCGI processes and keep them running. Using mod_wsgi you also have the option of easily changing your mind and moving an application back into the main Apache child processes (like in mod_python) if performance is more important for a specific application than memory consumption. Graham On Nov 6, 6:11 am, Joe <[EMAIL PROTECTED]> wrote: > Also, should I take a look at mod_wsgi? > > On Nov 5, 11:22 am, Joe <[EMAIL PROTECTED]> wrote: > > > I am considering switching from mod_python and apache to lighttpd and > > fastcgi because of the large number of virtual hosts I am serving. > > > Because each virtual host gets its own sub interpreter, each apache > > instance on my server can weigh in at over 160 megs. > > > I have heard that apache-mpm, mod_python and Django will not work, so > > I would like to know if using fastcgi with method=threaded would be a > > good way to solve my memory usage problems. > > > When I start one fastcgi process in threaded mode, it only uses 8 megs > > of memory, which is a lot more scalable than apache instances weighing > > in at 160 megs. > > > Thoughts, please. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
Thank you Graham for the fast reply Could you please elaborate a little since i am new to django. SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On ...and replace mysite.settings with the Python import path to your Django project's settings file. So how to know Python import path to Django project settings 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: mod_python: problem with http.conf
On Nov 6, 8:37 am, stranger <[EMAIL PROTECTED]> wrote: > Hello I am using Fedora 7. I am using Django for the first time. I > want the django to run on port 80. so that : > > http://localhost/mysite/ > > should retreive the Django dafault page. I have installed mod_python > and imported it into http.conf. > > In http.conf I have also: > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonDebug On > > > MY CLASS PATH IS: > $ echo $PATH > /home/priya/mysite:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/ > home/priya/bin No it isn't. That is your shell program search path. Nothing to do with Python module search path, nor Java class path for that matter. > CHECK THE SCREEN SHOT OF THE ERROR PAGE: > > http://img222.imageshack.us/my.php?image=screenshotuf4.png Read the mod_python documentation for Django properly. Specially, look at how PythonPath directive is used to define how you application can be found. http://www.djangoproject.com/documentation/modpython/ Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: New Forms Foreign key field Filtered choices
Brian, Are we to infer, by extrapolating, that since it appears that the coupling of the model definition and the form definition is undesirable passing the help_text argunment to a form will eventually not be done at the model? Instead, are we going to have to use a formfield_callback to pass the help_text to a form_for_model, for example? -rm On Nov 2, 5:11 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > What you really need is to use the formfield_callback argument to > form_for_instance. This allows you to override the default fields > that are returned for a given field in the model [1]. There is an > open bug, [2], that will allow for an easier way of overriding the > queryset that is ultimately rendered as the options. Until then you > will just need to subclass ModelChoiceField and re-implement the > choices property to use a custom queryset that does the filtering you > are describing. > > [1]http://www.djangoproject.com/documentation/newforms/#overriding-the-d... > [2]http://code.djangoproject.com/ticket/4787 > > On Nov 1, 3:15 pm, rm <[EMAIL PROTECTED]> wrote: > > > I know this is a painful subject. I have spent a couple of days > > trying to figure this out, and I am almost there. (I think. :) > > > Here is the model (simplified to bare bones): > > > class away(models.Model): > > contact = models.ForeignKey(Contact, verbose_name="Name of person > > away", limit_choices_to= {'is_staff':True}, db_column='contact') > > > As you can see Contact is another model being referenced here which > > has a field named "is_staff" that I want to use to filter out some > > contacts so that they do not display as options in my form to add or > > edit away instances. Unfortunately, the filter seems to only affect > > the way the field is displayed in the admin forms, not on regular > > forms. > > > This is how the start of my view to edit away instances looks like: > > > def away_edit(request, away_id): > > aw = get_object_or_404(away, id=away_id) > > aw_form = forms.form_for_instance(aw) > > > When displaying that form the 'contact' field displays as a dropdown > > list, but it includes the choices I wanted filtered out. So, after a > > lot of searching, I found this post which seems to be addressing the > > same issue: > > >http://groups.google.com/group/django-users/browse_thread/thread/cbbf... > > > However, I can't make it work. This is how I have translated the > > advice to my view: > > > def away_edit(request, away_id): > > aw = get_object_or_404(away, id=away_id) > > aw_form = forms.form_for_instance(aw) > > aw_form.base_fields['contact']=forms.ChoiceField(choices=[(obj.id, > > obj.name) for obj in Contact.objects.filter(is_staff=True)]) > > > When I do that, the form displays correctly and it actually does > > filter out the choices as I want. But, when I submit the form I get > > an error telling me that "away_away.contact may not be NULL". > > > Can someone please explain to me why it gives me that error? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: New Forms Foreign key field Filtered choices
Brian, Are we to infer, by extrapolating, that since it appears that the coupling of the model definition and the form definition is undesirable passing the help_text argunment to a form will eventually not be done at the model? Instead, are we going to have to use a formfield_callback to pass the help_text to a form_for_model, for example? -rm On Nov 2, 5:11 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > What you really need is to use the formfield_callback argument to > form_for_instance. This allows you to override the default fields > that are returned for a given field in the model [1]. There is an > open bug, [2], that will allow for an easier way of overriding the > queryset that is ultimately rendered as the options. Until then you > will just need to subclass ModelChoiceField and re-implement the > choices property to use a custom queryset that does the filtering you > are describing. > > [1]http://www.djangoproject.com/documentation/newforms/#overriding-the-d... > [2]http://code.djangoproject.com/ticket/4787 > > On Nov 1, 3:15 pm, rm <[EMAIL PROTECTED]> wrote: > > > I know this is a painful subject. I have spent a couple of days > > trying to figure this out, and I am almost there. (I think. :) > > > Here is the model (simplified to bare bones): > > > class away(models.Model): > > contact = models.ForeignKey(Contact, verbose_name="Name of person > > away", limit_choices_to= {'is_staff':True}, db_column='contact') > > > As you can see Contact is another model being referenced here which > > has a field named "is_staff" that I want to use to filter out some > > contacts so that they do not display as options in my form to add or > > edit away instances. Unfortunately, the filter seems to only affect > > the way the field is displayed in the admin forms, not on regular > > forms. > > > This is how the start of my view to edit away instances looks like: > > > def away_edit(request, away_id): > > aw = get_object_or_404(away, id=away_id) > > aw_form = forms.form_for_instance(aw) > > > When displaying that form the 'contact' field displays as a dropdown > > list, but it includes the choices I wanted filtered out. So, after a > > lot of searching, I found this post which seems to be addressing the > > same issue: > > >http://groups.google.com/group/django-users/browse_thread/thread/cbbf... > > > However, I can't make it work. This is how I have translated the > > advice to my view: > > > def away_edit(request, away_id): > > aw = get_object_or_404(away, id=away_id) > > aw_form = forms.form_for_instance(aw) > > aw_form.base_fields['contact']=forms.ChoiceField(choices=[(obj.id, > > obj.name) for obj in Contact.objects.filter(is_staff=True)]) > > > When I do that, the form displays correctly and it actually does > > filter out the choices as I want. But, when I submit the form I get > > an error telling me that "away_away.contact may not be NULL". > > > Can someone please explain to me why it gives me that error? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
mod_python: problem with http.conf
Hello I am using Fedora 7. I am using Django for the first time. I want the django to run on port 80. so that : http://localhost/mysite/ should retreive the Django dafault page. I have installed mod_python and imported it into http.conf. In http.conf I have also: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On MY CLASS PATH IS: $ echo $PATH /home/priya/mysite:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/ home/priya/bin CHECK THE SCREEN SHOT OF THE ERROR PAGE: http://img222.imageshack.us/my.php?image=screenshotuf4.png Advance thank you for the help --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Are the admin site templates cached?
Hello everyone, I've got a problem with Django that is driving me mad. I cannot make changes to the admin templates on my live server. In my dev environment everything works fine. I'm sure everything is setup correctly (I rememebered to put them in the admin/ subfolder). I even tried renaming all the original admin templates in the django source folder. This had no effect. If I put other templates in the admin directoy (for example 404.html) this shows up correctly but the core admin templates will not reload. I am using fcgi rather than mod_python as I am on shared hosting. Does the admin engine cache templates? Any suggestions would be greatly appreciated. Thanks, Ben Griffiths --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django Meet-up in Berlin on Wednesday 7th Nov. 20:00
Location is the Bar/Restaurant Sankt Oberholz http://plazes.com/plazes/40030:sankt_oberholz Cheers Reinhard --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Strange UnicodeDecodeError in template
I have a bit of a problem with a project I'm creating. I get an UnicodeDecodeError from some of the template code. The traceback is here: http://dpaste.com/24285/ It tries to decode the title field from unicode into ascii, but I cannot seem to understand why... I have dpaste'd the code in question. Template: http://dpaste.com/24284/ Model (where the get_task function is): http://dpaste.com/24281/ View (I suppose that's rather irrelevant): http://dpaste.com/24286/ Since the code is open source, you can browse it in its entirety here: http://codebrowse.launchpad.net/~mikl/kaplan/kaplan.dev/files If anyone can figure this out, you will have my eternal gratitude Thanks to Magus- in #django for trying - if you are reading this, I changed the part you pointed out to use Django's slugify function instead of str().lower(), but that wasn't it, sadly. Kind regards, Mikkel Høgh --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
Yeah, if I don't get the built-in to work, I'll go with a jQuery plugin that basically does the same thing. It'd be nice to get the built-in to work. Less maintenance on my end. :) /alex On 11/5/07, rm <[EMAIL PROTECTED]> wrote: > > Sounds good. In the mean time, I found this very cool alternative: > > http://www.dynarch.com/projects/calendar/ > > It worked great! > > > On Nov 5, 3:04 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > > On 11/5/07, rm <[EMAIL PROTECTED]> wrote: > > > > > > > > > Has anyone gotten this to work with a datetime field and a newform of > > > the type form_from_model? > > > > I will be trying it tonight, so I will let you know. > > > > /alex > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: static images with built-in django server
Try this one: http://www.djangoproject.com/documentation/db-api/#get-foo-filename To retrieve a image or file absolute url simply use: {{ object.get_myImageObject_url }} Absolute URL is compiled according to settings.py definition of MEDIA_URL and therefore changes automatically at deployment. On 7 okt., 05:07, staff-gmail <[EMAIL PROTECTED]> wrote: > Tim Chase wrote: > >> Thanks. Yes, using relative paths is the right idea - it's a shame that > >> the baseurl'shave to be hard coded in the templates. I understand > >> from a web efficiency standpoint of Django not handling static content > >> but from an application development standpoint this is a real complexity > >> we don't need. I can see this becoming a real mess when constantly > >> updating between development and production. I did see another blog > >> which demonstrated a way to use baseurlvariables for static content > >> with template tags but again this cummulative complexity for common > >> things just becomes a showstopper for us. Somehow the baseurlpath > >> should just be a simple entry in Settings.py and defaulted to the > >> project location. > > > I've gotten around this by adding a couple lines at the bottom of > > my urls.py that, if it's running as the development server (as > > determined by having "runserver" as an entry in sys.argv), it > > adds an entry in the URLs.py to allow Django to handle media: > > > # if you want to use the production site's media location > > # MEDIA_PATH = settings.MEDIA_ROOT > > # if you want to use a different directory for testing purposes > > # MEDIA_PATH = '../media' > > MEDIA_PATH = '../media' > > if 'runserver' in sys.argv: > > urlpatterns += patterns('', > > (r'^media/(?P.*)$', > > 'django.views.static.serve', > > {'document_root': MEDIA_PATH} > > ), > > ) > > > It may not be an ideal solution, but it serves my purposes, > > allowing me to access my media in development, while still > > allowing Apache to handle my media in production. > > It seems like a good solution - I still can'tgetanimagedisplayed - > any idea which settings are not matching ? I've tried locating the > /media folder in both /myproject and /myapp with no success > > template: > > > settings.py > MEDIA_ROOT = './media/' > MEDIA_URL = 'media/' > > urls.py > MEDIA_PATH = '../media' > if 'runserver' in sys.argv: > urlpatterns += patterns('', > > (r'^media/(?P.*)$','django.views.static.serve',{'document_root': > MEDIA_PATH}), > ) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
Sounds good. In the mean time, I found this very cool alternative: http://www.dynarch.com/projects/calendar/ It worked great! On Nov 5, 3:04 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > On 11/5/07, rm <[EMAIL PROTECTED]> wrote: > > > > > Has anyone gotten this to work with a datetime field and a newform of > > the type form_from_model? > > I will be trying it tonight, so I will let you know. > > /alex --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Oh boy, I've gone and done it now.
Thanks guys. That's exactly what it looks like. I think I'm going to just roll back to the previous version I had for now, then sort all this out when I have more time. On Nov 5, 2:19 pm, jake elliott <[EMAIL PROTECTED]> wrote: > hi baxter - > > On Mon, 2007-11-05 at 10:35 -0800, [EMAIL PROTECTED] wrote: > > OK, I attempted to install patch 2070, and failed miserably, messing > > up /core/handlers/modpython.py among other things. When I realized I > > had done so, I tried updating and then reinstalling django to get back > > to a clean install. Now everything is broken. Most of the broken seems > > to relate to template tags and filters. > > these issues sound like unicode and templatetag addressing changes > documented herehttp://code.djangoproject.com/wiki/BackwardsIncompatibleChanges > > (see 5609 and 6289). > > > And then there's thumbnails, which insists TypeError: make_thumbnail() > > keywords must be strings, but I'm passing it as a string, exactly as I > > always have. > > the version of this library you have may not be compatible with new > unicode stuff in django. this might > help:http://groups.google.com/group/nesh-django-utils/browse_thread/thread... > > best > jake --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
On 11/5/07, rm <[EMAIL PROTECTED]> wrote: > > Has anyone gotten this to work with a datetime field and a newform of > the type form_from_model? I will be trying it tonight, so I will let you know. /alex --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
self referencing limit_choices_to
Hello, I have a little problem with the "limit_choices_to" functionality. I found two group discussions concerning the same problem, but the authors got no answers. http://groups.google.com/group/django-users/browse_thread/thread/fab619f35e322486/e9f34786dbba2666?lnk=gst=limit_choices_to#e9f34786dbba2666 http://groups.google.com/group/django-users/browse_thread/thread/881f29143ec8a6e/ffe217c861e090f2?lnk=gst=limit_choices_to#ffe217c861e090f2 -- class EventType(models.Model): desc = models.CharField(max_length=40, unique=True) valid_from = models.DateField() valid_to = models.DateField() . class Event(models.Model): date = models.DateField(core=True) type = models.ForeignKey(EventType, limit_choices_to = {'valid_from__lte': ? 'valid_to__gte': ?}) = should be the value Event.date --- errormessage if I type: self.date type = models.ForeignKey(EventType, limit_choices_to = {'valid_from__lte': self.date}) NameError: name 'self' is not defined --- errormessage if I type: date Incorrect date value: '' for column 'valid_from' at row 1 --- I hope that someone will help me! Regards Bernd --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
gettext is not defined - admin site
I use Django 0.96 in a SuSE with Python 2.3.3. I'm getting this JavaScript error: "gettext is not defined" when I try to edit an object with date field in the admin site. I have seen that occurs when calendar.js is trying to populate the month names in the correct language. I use language_code = es_ES and default_charset = utf-8 and i have configurated apache to use utf-8 as default charset. I also have found with FireBug that really the error is a Django error: UnicodeEncodeError at /convenios/admin/jsi18n/ ascii codec cant encode character u\xe9 in position 23: For this reason jsi18n doesn't load and i can't use gettext. Otherwise, in an Ubuntu installation of Django, with same lang code, and Python 2.5.1, all works fine. Any idea? Thanks a lot! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
Has anyone gotten this to work with a datetime field and a newform of the type form_from_model? On Nov 5, 11:07 am, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > Thanks Michael. > > This looks like exactly what I need. I apologize for not searching the > list first. I searched the web but that thread didn't show up. > > Thanks again. > > /alex > > On 11/5/07, Michael <[EMAIL PROTECTED]> wrote: > > > > > Check out: > >http://groups.google.com/group/django-users/browse_frm/thread/3328829... > > > If that doesn't help you, search this group for other posts on the > > subject. > > > Michael > > > On Nov 3, 2:04 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > > > When I use a DateTime field in my model, the admin automatically > > > creates a little javascript date picker. > > > > How do I get the same date picker in my user forms? I am using the > > > form_from_model method with newforms. > > > > Thanks! > > > > /alex --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Oh boy, I've gone and done it now.
hi baxter - On Mon, 2007-11-05 at 10:35 -0800, [EMAIL PROTECTED] wrote: > OK, I attempted to install patch 2070, and failed miserably, messing > up /core/handlers/modpython.py among other things. When I realized I > had done so, I tried updating and then reinstalling django to get back > to a clean install. Now everything is broken. Most of the broken seems > to relate to template tags and filters. these issues sound like unicode and templatetag addressing changes documented here http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges (see 5609 and 6289). > And then there's thumbnails, which insists TypeError: make_thumbnail() > keywords must be strings, but I'm passing it as a string, exactly as I > always have. the version of this library you have may not be compatible with new unicode stuff in django. this might help: http://groups.google.com/group/nesh-django-utils/browse_thread/thread/42d4db5985e5b8f best jake --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django Threaded Fastcgi Safe?
Also, should I take a look at mod_wsgi? On Nov 5, 11:22 am, Joe <[EMAIL PROTECTED]> wrote: > I am considering switching from mod_python and apache to lighttpd and > fastcgi because of the large number of virtual hosts I am serving. > > Because each virtual host gets its own sub interpreter, each apache > instance on my server can weigh in at over 160 megs. > > I have heard that apache-mpm, mod_python and Django will not work, so > I would like to know if using fastcgi with method=threaded would be a > good way to solve my memory usage problems. > > When I start one fastcgi process in threaded mode, it only uses 8 megs > of memory, which is a lot more scalable than apache instances weighing > in at 160 megs. > > Thoughts, please. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Oh boy, I've gone and done it now.
A newer version of Django may be passing in a unicode string instead of an ASCII one. The make_thumbnail() function may be expecting an ASCII string. On Nov 5, 1:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > OK, I attempted to install patch 2070, and failed miserably, messing > up /core/handlers/modpython.py among other things. When I realized I > had done so, I tried updating and then reinstalling django to get back > to a clean install. Now everything is broken. Most of the broken seems > to relate to template tags and filters. > > several templatetags no longer show up at all in the admin docs. It's > as though they're no longer valid for some reason. These are pretty > simple tags, too. > Others show up in admin, but when I try to use them I get "invalid > block tag" > And then there's thumbnails, which insists TypeError: make_thumbnail() > keywords must be strings, but I'm passing it as a string, exactly as I > always have. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using GeoDjango features with current trunk?
As Karen noted, I last merged on 10/26 to r6613 -- thus, the latest GeoDjango is more up-to-date than your latest checkout of trunk (r5988). > If the trunk and GeoDjango AREN'T currently compatible, would it be > possible for us to add geometry columns AFTER a syncdb creates the > "standard" model tables? Would the automatic admin still work in such a > situation? For all intents and purposes, the GeoDjango branch is identical to the latest merge of the trunk -- the largest difference is the addition of django.contrib.gis module. The rest of the changes to the trunk are limited in scope and few in number, and are only present to support the GIS features. There should not be a problem using GeoDjango for non-GIS Django applications. If you tried to interface with PostGIS geometry values on a vanilla trunk, you would most likely run into many problems -- a major one being that you would have to write your own custom field anyway for the admin to recognize the column, let alone manipulate its value. One possible route would be to inherit from TextField, but you'd be manipulating HEXEWKB (returned by PostGIS by default) in the admin, which isn't particularly intuitive. Moreover, you would have to write custom sql methods for each of the spatial operations you required. Thus, I have a feeling that implementing your own fields, and associated hacks to accomplish geospatial functionality may turn out being more "unstable" than just using GeoDjango to begin with. Regards, -Justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MacOS X Leopard + mod_pyton + mysql problems
It's actually really simple to build the client lib's you need to get the MySQL support working. Download the Community Server Source and you can build it from that. I hade the same problem but for QT and MySQL support, take a look at, http://demo.grenangen.se/drupal There you will find a simple instruction set on how to build the community server source for Leopard. If that doesn't help, get back to me and I'll try to help further. On Oct 31, 4:32 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Argh. The "Universal" version of MySQL includes only: ppc, ppc64, > i386 > > [Macintosh:src/mysql-5.0.45-osx10.4-universal/lib] benha% file > libmysqlclient_r.a > libmysqlclient_r.a: Mach-O universal binary with 3 architectures > libmysqlclient_r.a (for architecture i386): current ar archive > libmysqlclient_r.a (for architecture ppc64):current ar archive > libmysqlclient_r.a (for architecture ppc): current ar archive > > So that means that in order to link to the MySQL libs, we'll need to > build/install a 64-bit version of MySQL. Sigh... > > Anyone have a set of reliable, working instructions for doing that? > > -Ben > > On Oct 30, 7:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Stuck in the same place. > > > I'm guessing you d/l'd and installed the MySQL OSX 10.4 x86 installer > > package from MySQL. I did. I think it's only i386. > > > They also have a Universal Binary OSX 10.4 file up there, but only in > > Tar format. I'm d/l'ing that now to try. Hopefully it's got the > > x86_64 image in it as well. > > > -Ben --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Oh boy, I've gone and done it now.
OK, I attempted to install patch 2070, and failed miserably, messing up /core/handlers/modpython.py among other things. When I realized I had done so, I tried updating and then reinstalling django to get back to a clean install. Now everything is broken. Most of the broken seems to relate to template tags and filters. several templatetags no longer show up at all in the admin docs. It's as though they're no longer valid for some reason. These are pretty simple tags, too. Others show up in admin, but when I try to use them I get "invalid block tag" And then there's thumbnails, which insists TypeError: make_thumbnail() keywords must be strings, but I'm passing it as a string, exactly as I always have. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using GeoDjango features with current trunk?
I was in a similar situation a few months ago. The GeoDjango branch api is really handy and I was hoping to use it on some models that were sitting in a 0.96 release. We definitely couldn't go with the unstable branch for our production environment so I ended up just writing a few custom sql queries in my models to set the geometry properties on textfields instead. One of my methods triggered by the save method goes something like this: def set_geom_properties(self): """ triggered by save method we set some geom properties that we don't want to calculate everytime from postgis """ if self.polygon: center = ''#get centroid of area cursor = connection.cursor() geom_q = """ select geometryfromtext('POLYGON((%s))',4269); """ % (self.polygon) cursor.execute(geom_q) geom = cursor.fetchone()[0] self.geom = geom centroid_q = """ select x(centroid(transform(GeomFromEWKT('%s'), 4269))) as longitude, y(centroid(transform(GeomFromEWKT('%s'), 4269))) as latitude """ % (geom,geom) cursor.execute(centroid_q) lon, lat = cursor.fetchone() self.centroid = "%f, %f" % (lat,lon) When GeoDjango makes it into a stable release I will definitely use it and just modify my code a little bit. Its also nice to know how to setup your own geometry columns in postgis and do the queries. -Matt On 11/5/07, Hancock, David (DHANCOCK) <[EMAIL PROTECTED]> wrote: > > > We're using the Django trunk (r5988), but are about to dive into adding some > PostGIS geometry columns to a few of our models. It appears that GeoDjango > is its own branch--has anyone got advice about whether we can use it with a > more recent checkout than it branched from? > > The GeoDjango additions look quite easy to use, a plus for our organization > that's just getting started with GIS. > > If the trunk and GeoDjango AREN'T currently compatible, would it be possible > for us to add geometry columns AFTER a syncdb creates the "standard" model > tables? Would the automatic admin still work in such a situation? > > Thanks in advance for any advice you've got. Django is becoming our tool of > choice for data that needs to have an editing interface for internal use and > be queryable from our other applications and website. > > Cheers! > -- > David Hancock | [EMAIL PROTECTED] > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using GeoDjango features with current trunk?
On 11/5/07, Karen Tracey <[EMAIL PROTECTED]> wrote: ... >You can check the branch log: > > http://code.djangoproject.com/log/django/branches/gis > > to see how current it is with respect to trunk. Look for the most recent > log message that starts "Merged revisions". In this case gis was updated > from trunk on Oct. 26 and contains all trunk changes through r6613. > All correct, thanks for the informative reply, Karen. One more note: the GeoDjango branch is off trunk because it's currently unstable in features and bugs. We'll be merging from trunk revs periodically, as well as committing bugfixes and new features to it. If you'll be using the branch, please be aware of which version you're running on and be careful updating both in terms of trunk rev on which it is based and features you depend on. The latest merge from trunk was done to include a security bugfix. Unless there is a similarly urgent reason, we'll try to pick a fairly stable trunk rev when we merge up. We'll be happy to support you in your use of the branch, of course, but understand that there are fewer people using the branch than trunk, so there are fewer people available to answer your questions. You should be prepared to be involved in troubleshooting the branch. Cheers, Jeremy --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using GeoDjango features with current trunk?
On 11/5/07, Hancock, David (DHANCOCK) <[EMAIL PROTECTED]> wrote: > > We're using the Django trunk (r5988), but are about to dive into adding > some PostGIS geometry columns to a few of our models. It appears that > GeoDjango is its own branch--has anyone got advice about whether we can use > it with a more recent checkout than it branched from? > A branch is its own self-contained complete package, you use it by itself, not it along with some version of Django. The branch maintainer is responsible for periodically merging changes made to the trunk into the branch, so that the branch stays reasonably current with fixes and improvements made to the trunk. You can check the branch log: http://code.djangoproject.com/log/django/branches/gis to see how current it is with respect to trunk. Look for the most recent log message that starts "Merged revisions". In this case gis was updated from trunk on Oct. 26 and contains all trunk changes through r6613. Karen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Is Django Threaded Fastcgi Safe?
I am considering switching from mod_python and apache to lighttpd and fastcgi because of the large number of virtual hosts I am serving. Because each virtual host gets its own sub interpreter, each apache instance on my server can weigh in at over 160 megs. I have heard that apache-mpm, mod_python and Django will not work, so I would like to know if using fastcgi with method=threaded would be a good way to solve my memory usage problems. When I start one fastcgi process in threaded mode, it only uses 8 megs of memory, which is a lot more scalable than apache instances weighing in at 160 megs. Thoughts, please. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
Thanks Michael. This looks like exactly what I need. I apologize for not searching the list first. I searched the web but that thread didn't show up. Thanks again. /alex On 11/5/07, Michael <[EMAIL PROTECTED]> wrote: > > Check out: > http://groups.google.com/group/django-users/browse_frm/thread/3328829f1ed7f788/ > > If that doesn't help you, search this group for other posts on the > subject. > > Michael > > > On Nov 3, 2:04 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > > When I use a DateTime field in my model, the admin automatically > > creates a little javascript date picker. > > > > How do I get the same date picker in my user forms? I am using the > > form_from_model method with newforms. > > > > Thanks! > > > > /alex > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using GeoDjango features with current trunk?
We're using the Django trunk (r5988), but are about to dive into adding some PostGIS geometry columns to a few of our models. It appears that GeoDjango is its own branch--has anyone got advice about whether we can use it with a more recent checkout than it branched from? The GeoDjango additions look quite easy to use, a plus for our organization that's just getting started with GIS. If the trunk and GeoDjango AREN'T currently compatible, would it be possible for us to add geometry columns AFTER a syncdb creates the "standard" model tables? Would the automatic admin still work in such a situation? Thanks in advance for any advice you've got. Django is becoming our tool of choice for data that needs to have an editing interface for internal use and be queryable from our other applications and website. Cheers! -- David Hancock | [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateTime Picker
Check out: http://groups.google.com/group/django-users/browse_frm/thread/3328829f1ed7f788/ If that doesn't help you, search this group for other posts on the subject. Michael On Nov 3, 2:04 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > When I use a DateTime field in my model, the admin automatically > creates a little javascript date picker. > > How do I get the same date picker in my user forms? I am using the > form_from_model method with newforms. > > Thanks! > > /alex --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to debug a view using breakpoints in Eclipse?
On 11/5/07, crybaby <[EMAIL PROTECTED]> wrote: > > > My variable view window doesn't show anything. All I get in the > Variable View is:: > > Global: > error > > error > > I set the break points, but nothing showing up in Variable window in > debugger perspective except "Global error error". > > Any suggestions? > > When I start the dev server inside eclipse under debugger mode, in the > console window it mention: > "PyDev Debugger > > Validating models...blah blah" > > So, PyDev Debugger doesn't support displaying object attributes in > eclipse Variable window that is located at right top corner? How can > I just use regular debugger that enables me to view object attributes > in Variable window? PyDev debugger does support displaying variables in the Eclipse variable window, I don't know why it isn't working for you. I generally use Linux, not Windows, but I just tried it on my Windows XP box and it worked there as well. I'm not sure what all versions of things you are running, but I have Eclipse 3.2.2 and PyDev 1.3.9. I did not have the PyDev extensions module but added that on the WinXP box and it didn't break anything. I've run using both Python 2.4 and 2.5.1 and while PyDev seems to run more cleanly under 2.4 (I get a lot of red warnings in the console under 2.5.1), nothing that I've noticed (including variable display) actually breaks under 2.5.1. You might get better help for this on a PyDev user's list. You might also check the Eclipse error log (Window->Show View->Error Log) to see if it gives any more clues about why PyDev is having trouble displaying variables. It's definitely not normal for this to be failing. Karen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: RESTful Geodjango
> (2) The gis branch should really use a better name than "NoField" here. > Not a lot of code calls get_internal_type() -- the main critical piece > being db_type(). In all the cases where django.contrib.gis overrides > get_internal_type(), they are also returning None from db_type(). So the > code should probably use descriptive names for the internal type. The "NoField" nomenclature is a result of legacy implementation. When I first implemented the GIS branch there was no `db_type` method to work with. Moreover, I needed an internal type that wouldn't actually create SQL for the column because PostGIS geometry columns are added with a stored procedure. Using "NoField," (from what I can tell, now only used by ManyToManyFields), allowed me to achieve the functionality without patching django's core code. I commented out the get_internal_type() in my code, and was able to sync the database just fine. Since db_type returns None, get_internal_type() would default to using the parent class' routine, and the expected name (e.g., "PointField") would be returned. Do you see any problems with the approach of simply removing the get_internal_type() routine? -Justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Obscure error installing Django
revision 6300 seems to work fine for me. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: to_python ignored with custom IntegerField
On 11/5/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > This thread motivated me to finish this work. Update to r6652 and you'll > have some documentation and a helper metaclass for the common case (if > you need something more advanced, you can obviously do without the > metaclass and code __set__ and __get__ directly, as Marty has done in > his duration field). Interesting approach with the metaclass, I hadn't considered that. Just a one-line update to what seems like it should work, and all is well. I'll get to work tonight, updating DurationField and filestorage to use this technique. Thanks for the hard work on this! -Gul --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: New Forms Foreign key field Filtered choices
Malcolm, Thanks for the advice. It took me a little bit of fiddling to figure out that the proper syntax to make your suggestion work but I think I got it. form.fields['contact'].choices = forms.widgets.Select.choices=[(obj.id, obj.__str__()) for obj in filtered_choices] I am not sure why you think it is simpler to assign fields to the instance than to the base_fields since then you have to do it twice per view, once for the case of the Post request and again for the case of a blank form. While I have your attention, I wonder if you can give me your opinion on this variation: form.fields['contact'].choices = forms.widgets.Select.choices=[(None, "- - - - - - - - - - - - - - - -")]+[(obj.id, obj.__str__()) for obj in filtered_choices] I did that to replicate the feel of the widget that starts with a blank choice rather than the first name on the choices list. It seems to work. It is caught by the validator with a nice message saying: "Please select a valid choice. That choice is not one of the available choices." So, it looks right, but it feels like a hack. :) On Nov 2, 9:25 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-11-02 at 20:35 +, rm wrote: > > OK, I think I finally got it. (Thanks to Python's introspection and > > interactive shell!) Here is how I got it to work in my view: > > > def away_edit(request, away_id): > > aw = get_object_or_404(away, id=away_id) > > aw_form = forms.form_for_instance(aw) > > filtered_choices = Contact.objects.filter(is_staff=True) > > aw_form.base_fields['contact'].widget = > > forms.widgets.Select(choices=[(obj.id, obj.__str__()) for obj in > > filtered_choices]) > > Usually ,assigning to base_fields is overdoing things and diving a bit > too deep. > > If you can, I'd suggest keeping things simple and just assigning to > fields on the *instance* of the form. So, something like this: > > aw_form = forms.form_for_instance(aw) > form_instance = aw() > form_instance.fields['contact'].choices = ... > > The reason for doing it this way is that the 'contact' Field instance > has a property for "choices", so when you assign to choices, it updates > both the field's copy and the widget's version in sync. It's also just a > bit neater -- you only have to worry about "fields" and not > "base_fields" plus "fields" (you usually can't avoid "fields" if you're > using newforms). > > Regards, > Malcolm > > -- > A clear conscience is usually the sign of a bad > memory.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: to_python ignored with custom IntegerField
On Sun, 2007-11-04 at 14:25 +1100, Malcolm Tredinnick wrote: [...] > What needs to be changed for field subclassing -- and I keep meaning to > finish this work, along with my 5 other highest priorities -- is that > for custom fields (only!) we install attributes as part of contribute to > class so that, via Python's descriptor protocol (__set__ and __get__) > conversion automatically happens. This thread motivated me to finish this work. Update to r6652 and you'll have some documentation and a helper metaclass for the common case (if you need something more advanced, you can obviously do without the metaclass and code __set__ and __get__ directly, as Marty has done in his duration field). The documentation is also online at http://www.djangoproject.com/documentation/custom_model_fields/ and linked from the model API docs (although not yet on the front documentation page, since that is manually created). Report any bugs you find, but it's mostly a documentation change. There are still a couple of small things to add (like a custom SQL creation method similar to what the 'gis' branch needs) and a custom get_db_prep_select() method or something like that. That's tomorrow's job. I'm going to sleep now. Regards, Malcolm -- Always try to be modest and be proud of it! http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to debug a view using breakpoints in Eclipse?
My variable view window doesn't show anything. All I get in the Variable View is:: Global: error error I set the break points, but nothing showing up in Variable window in debugger perspective except "Global error error". Any suggestions? When I start the dev server inside eclipse under debugger mode, in the console window it mention: "PyDev Debugger Validating models...blah blah" So, PyDev Debugger doesn't support displaying object attributes in eclipse Variable window that is located at right top corner? How can I just use regular debugger that enables me to view object attributes in Variable window? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: RESTful Geodjango
On Sat, 2007-10-20 at 14:01 -0500, Jeremy Dunck wrote: > On 10/20/07, Ariel Mauricio Nunez Gomez <[EMAIL PROTECTED]> wrote: > > POINT ( 31.00892404 > ... > > That NoField type, is it ok? > > Well, it depends what you're going to do with it. :) > > That 'NoField' comes from > django.db.models.fields.Field.get_internal_type. It was originally > used during table creation (as in manage.py syncdb) and introspection. > It is also included when serializing objects (as the REST interface > does), but it appears to be only serving as an annotation for > convenience-- it's not actually used in deserialization. > > The problem you may run into is that there are various types of GIS > fields, all of which will return NoField. Further, other custom field > types may return NoField and not actually be GIS fields. Again, this > doesn't affect Django-proper, but if you need to do something > intelligent based on the type attribute, you may have trouble. > > ...A simple solution to fix Django on this issue isn't immediately > apparent. I know Malcolm was noodling on improving Field subclassing, > and this get_internal_type bit is one thing that needs improvement. I was looking at this today as I was writing all the documentation for field subclassing. Two things sort of became clear: (1) It's usually not going to be a problem beyond a display one. Nothing uses the "type" field inside Django and if external code wants to use it, it can get the real field type by introspecting the model class. (2) The gis branch should really use a better name than "NoField" here. Not a lot of code calls get_internal_type() -- the main critical piece being db_type(). In all the cases where django.contrib.gis overrides get_internal_type(), they are also returning None from db_type(). So the code should probably use descriptive names for the internal type. (Don't worry, I'll file a ticket about that last part shortly.) I'm also about to commit a whole bunch of field subclassing stuff -- mostly documentation -- and this includes a barrier to catch cases where get_internal_type() returns something not in the db_types list. Then db_type() will return None. The idea here is that if you are creating a field which doesn't use Django's standard code to create the database column, then you can implement get_internal_type() to return your own (non-standard) value and everything else will Just Work(tm). Regards, Malcolm -- The only substitute for good manners is fast reflexes. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: my filter cannot work
On Mon, 2007-11-05 at 05:02 -0800, [EMAIL PROTECTED] wrote: > here is my filter: > from django import template > import datetime > > register = template.Library() > > @register.filter > def mytimeiff(timestamp = None): Typo here. Almost certainly should be "mytimediff" -- you left out the 'd'. The error message you are seeing is a sure sign that there's a spelling error somewhere, so this is the first sort of thing to look for. > """ > Returns a humanized string representing time difference > between now() and the input timestamp. > > The output rounds up to days, hours, minutes, or seconds. > 4 days 5 hours returns '4 days' > 0 days 4 hours 3 minutes returns '4 hours', etc... > """ > > timeDiff = datetime.datetime.now() - timestamp > days = timeDiff.days > hours = timeDiff.seconds/3600 > minutes = timeDiff.seconds%3600/60 > seconds = timeDiff.seconds%3600%60 > > str = "" > tStr = "" > if days > 0: > if days == 1: tStr = "day" > else: tStr = "days" > str = str + "%s %s" %(days, tStr) > return str > elif hours > 0: > if hours == 1: tStr = "hour" > else: tStr = "hours" > str = str + "%s %s" %(hours, tStr) > return str > elif minutes > 0: > if minutes == 1:tStr = "分钟" > else: tStr = "分钟" Unrelated to your original question, but either you have a line like # coding: utf-8 as the first or second line of your file, or these lines (using non-ASCII characters) are might be a cause of problems down the track. > str = str + "%s %s" %(minutes, tStr) > return str > elif seconds > 0: > if seconds == 1:tStr = "秒" > else: tStr = "秒" > str = str + "%s %s" %(seconds, tStr) > return str > else: > return None > > and i use it in the templates as below: > > {% load mytimediff %} > {{ s.time|mytimediff }} > > got this error: > Exception Type: TemplateSyntaxError > Exception Value: Invalid filter: 'mytimediff' > > can somebody help me out, thanks! Regards, Malcolm -- How many of you believe in telekinesis? Raise my hand... http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
my filter cannot work
here is my filter: from django import template import datetime register = template.Library() @register.filter def mytimeiff(timestamp = None): """ Returns a humanized string representing time difference between now() and the input timestamp. The output rounds up to days, hours, minutes, or seconds. 4 days 5 hours returns '4 days' 0 days 4 hours 3 minutes returns '4 hours', etc... """ timeDiff = datetime.datetime.now() - timestamp days = timeDiff.days hours = timeDiff.seconds/3600 minutes = timeDiff.seconds%3600/60 seconds = timeDiff.seconds%3600%60 str = "" tStr = "" if days > 0: if days == 1: tStr = "day" else: tStr = "days" str = str + "%s %s" %(days, tStr) return str elif hours > 0: if hours == 1: tStr = "hour" else: tStr = "hours" str = str + "%s %s" %(hours, tStr) return str elif minutes > 0: if minutes == 1:tStr = "分钟" else: tStr = "分钟" str = str + "%s %s" %(minutes, tStr) return str elif seconds > 0: if seconds == 1:tStr = "秒" else: tStr = "秒" str = str + "%s %s" %(seconds, tStr) return str else: return None and i use it in the templates as below: {% load mytimediff %} {{ s.time|mytimediff }} got this error: Exception Type: TemplateSyntaxError Exception Value:Invalid filter: 'mytimediff' can somebody help me out, thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to display is better?
thankss very much! this is a common situation in forum display, to display sticky post first, then recommended post, then..., then go to normal posts. On 11月5日, 下午4时55分, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-11-05 at 00:28 -0800, [EMAIL PROTECTED] wrote: > > i have a queryset with 100 recoders, there are 20 recoders with > > "stick=True". > > so i want to display these 20 recoder first,then display other 80 > > recordes. my question is: > > > 1. i can write to for loop in templates, so display 20 first, then > > display 80 with if clause. > > 2. i get 2 queryset in view.py, one for 20 recoders, the other for 80 > > recoders, then display separtely in templates file. > > > which is better so performance? > > It will very much depend on how long it takes to construct the > queyrsets. There is no substitute for timing it. The only word of > caution I always have in these situations is to bear in mind that both > solutions might very well be "fast enough". Sometimes you don't need as > fast as possible, only fast enough. > > If I had to guess, I would say the first option will be faster, but > probably slower than the idea mentioned below. But years of experience > have taught me not to trust my guesses. > > > do you have other suggestion for displaying such recoders? > > Can you put order the queryset? Remember that you can sort by booleans, > so you can attach .order_by('stick') to your queryset? One thing to > watch out for: I can't remember if boolean ordering is consistent across > all databases or not: that is, you might have to experiment to see > whether your database sorts True before False, or vice verse (if False > sorts before True, then order_by('-stick') will work). > > Regards, > Malcolm > > -- > I don't have a solution, but I admire your > problem.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
m2m ordering question
i´m having a model for a movie and I´d like to assign some stars using an m2m-relationship. using the admin-interface, I´m assigning stars in a specific order (the most important star first and so on). in the database, the stars are saved in the "right" order - the first one has the lowest ID and so forth. BUT: when I save the movie and I´m editing it again, the order of the stars is different to what I saved (it´s not the order from the database). is it possible to get the stars in the right order or do I have to change my models and use edit_inline with a position-field? thanks, patrick --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Hey Django-users@googlegroups.com ;)
http://www.hi5.com/register/IK2di?inviteId=A_9eb8baf_akOdwZp3end166431663 Jose --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Hey Django-users@googlegroups.com ;)
http://www.hi5.com/register/QClCa?inviteId=A_9eb8baf_foMCO2p5ZKd166431663 Jose --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: settings.py gets imported twice
Am Montag, 5. November 2007 10:55 schrieb Malcolm Tredinnick: > On Mon, 2007-11-05 at 10:46 +0100, Thomas Güttler wrote: > > Hi, > > > > settings.py gets imported twice. This is bad, if you want to > > set up the logging module, since you register the handler twice > > and you get all log messages twice. > > [...] > > It's actually fairly hard to avoid this for a variety of reasons. I > think we used to import it more than twice in some situations. Maybe we > still do. User-defined commands and processing the --settings option > becomes more fiddly, for example. So the answer is "don't rely on it > only being imported once". OK, maybe it should be documented. The usual way to use global variables with a different module: http://effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm did not work for me, since the modul gets imported with different __name__'s. The first time __name__ is 'logconfig' the second time it is 'myproject.logconfig'. A found this solution. # file logconfig.py import logging if not hasattr(logging, "set_up_done"): logging.set_up_done=False def set_up(myhome): if logging.set_up_done: return logging.set_up_done=True Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Large streaming uploads (#2070) doesn't work for me at all
> If you run Django with its standalone development server do you see > the same behaviour? Ie., does the Django process blow out in size? > > Unless you are bound to mod_python because of other code which uses > its APIs directly, then also consider trying to host Django under > mod_wsgi (http://www.modwsgi.org) to see if it exhibits the same > problem. > > Doing both these things would help to highlight whether this is a > Django issue, a mod_python issue or a general Apache problem with your > configuration. Thanks for your suggestions. Problem doesn't occur when I use development server or mod_wsgi, so it is clearly a mod_python bug. Unfortunately, I don't have time currently to investigate why it happens. Now I hit another problem though. Seems that #2070 patch is seriously outdated. django/core/validators.py is not touched by it, and this causes exception: Traceback (most recent call last): File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in _real_get_response 81. response = callback(request, *callback_args, **callback_kwargs) File "/var/lib/python-support/python2.5/django/contrib/admin/views/ decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "/var/lib/python-support/python2.5/django/views/decorators/ cache.py" in _wrapped_view_func 39. response = view_func(request, *args, **kwargs) File "/var/lib/python-support/python2.5/django/contrib/admin/views/ main.py" in change_stage 332. errors = manipulator.get_validation_errors(new_data) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in get_validation_errors 61. errors.update(field.get_validation_errors(new_data)) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in get_validation_errors 378. self.run_validator(new_data, validator) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in run_validator 368. validator(new_data.get(self.field_name, ''), new_data) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in isValidImage 713. validators.isValidImage(field_data, all_data) File "/var/lib/python-support/python2.5/django/core/validators.py" in isValidImage 180. content = field_data['content'] KeyError at /admin/account/pokerroom/5/ 'content' I'll try to post this to the Django Trac again. Eugene --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem uploading several files (images) using a single form
Hmm... no reply. Its either a very dumb question or I explained it very bad! I though I would reactivate it since I didn't find out yet... Thanks! Divan On Nov 4, 5:57 am, Divan Roulant <[EMAIL PROTECTED]> wrote: > Hello, > > I need to upload several pictures from a single form. Then (I think) I > need to loop through the list of FILES and bind the data to a form and > save it. However, my code below doesn't work. No images are saved and > all I get is the data from the other fields of the last picture, saved > the number of times the loop runs. > > for i in request.FILES.getlist('photo'): > my_form = form_for_model(TheForm) > my_form_instance = my_form(request.POST, i) > if my_form_instance.is_valid(): > f = my_form_instance.save() > f.save() > else: > # Catch exceptions > > I guess that the nature of "i" is not the proper one for the line > "my_form _instance = my_form(request.POST, i)". If so, what should be > done to bind the right data each time the loop is executed? > > Thanks! > > Divan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: settings.py gets imported twice
On Mon, 2007-11-05 at 10:46 +0100, Thomas Güttler wrote: > Hi, > > settings.py gets imported twice. This is bad, if you want to > set up the logging module, since you register the handler twice > and you get all log messages twice. [...] It's actually fairly hard to avoid this for a variety of reasons. I think we used to import it more than twice in some situations. Maybe we still do. User-defined commands and processing the --settings option becomes more fiddly, for example. So the answer is "don't rely on it only being imported once". If you need something to be only done once, no matter how many times it is imported, you will need to set a flag somewhere. For example, you could set a global variable that indicates you have already set up your logging. Or set an indicator on some other class. For logging, I would think that a call to getLogger('name') would probably do the trick. If it returns nothing, you still need to do the setup. Regards, Malcolm -- If it walks out of your refrigerator, LET IT GO!! http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Obscure error installing Django
Hi, I'm having the same problem on shared hosting (asmallorange). Did anybody find a solution? I have the 1.2.2 version of python-mysql and the latest trunk of django (svn). Thanks, Martin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
settings.py gets imported twice
Hi, settings.py gets imported twice. This is bad, if you want to set up the logging module, since you register the handler twice and you get all log messages twice. Here are the stacktraces I created for debugging this: ===> python manage.py test admin import logconfig Traceback (most recent call last): File "manage.py", line 12, in ? import settings # Assumed to be in the same directory. Traceback (most recent call last): File "manage.py", line 19, in ? execute_manager(settings) File "/localhome/user/myproject/django/core/management/__init__.py", line 277, in execute_manager utility.execute() File "/localhome/user/myproject/django/core/management/__init__.py", line 225, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/localhome/user/myproject/django/core/management/__init__.py", line 177, in fetch_command self.project_directory)[subcommand] File "/localhome/user/myproject/django/core/management/__init__.py", line 86, in get_commands for app_name in settings.INSTALLED_APPS: File "/localhome/user/myproject/django/conf/__init__.py", line 28, in __getattr__ self._import_settings() File "/localhome/user/myproject/django/conf/__init__.py", line 57, in _import_settings self._target = Settings(settings_module) File "/localhome/user/myproject/django/conf/__init__.py", line 83, in __init__ mod = __import__(self.SETTINGS_MODULE, {}, {}, ['']) File "/localhome/user/myproject/settings.py", line 147, in ? This shnippet has a workaround: http://www.djangosnippets.org/snippets/16/ (I have not tested it yet) I think it would be better to avoid a second import. Any hints? Thomas -- Thomas Güttler, http://www.tbz-pariv.de/ Bernsdorfer Str. 210-212, 09126 Chemnitz, Tel.: 0371/5347-917 TBZ-PARIV GmbH Geschäftsführer: Dr. Reiner Wohlgemuth Sitz der Gesellschaft: Chemnitz Registergericht: Chemnitz HRB 8543 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to display is better?
On Mon, 2007-11-05 at 00:28 -0800, [EMAIL PROTECTED] wrote: > i have a queryset with 100 recoders, there are 20 recoders with > "stick=True". > so i want to display these 20 recoder first,then display other 80 > recordes. my question is: > > 1. i can write to for loop in templates, so display 20 first, then > display 80 with if clause. > 2. i get 2 queryset in view.py, one for 20 recoders, the other for 80 > recoders, then display separtely in templates file. > > which is better so performance? It will very much depend on how long it takes to construct the queyrsets. There is no substitute for timing it. The only word of caution I always have in these situations is to bear in mind that both solutions might very well be "fast enough". Sometimes you don't need as fast as possible, only fast enough. If I had to guess, I would say the first option will be faster, but probably slower than the idea mentioned below. But years of experience have taught me not to trust my guesses. > do you have other suggestion for displaying such recoders? Can you put order the queryset? Remember that you can sort by booleans, so you can attach .order_by('stick') to your queryset? One thing to watch out for: I can't remember if boolean ordering is consistent across all databases or not: that is, you might have to experiment to see whether your database sorts True before False, or vice verse (if False sorts before True, then order_by('-stick') will work). Regards, Malcolm -- I don't have a solution, but I admire your problem. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is it possible to debug a view using breakpoints in Eclipse?
Just so this is entered in the thread: I have a very similar problem in Komodo (the ActiveState IDE). I use the noreload option, and breakpoints in "my code" (i.e., applications I wrote) are reliable, but breakpoints in Django itself usually don't work. It's not quite 100% repeatable, sometimes the breakpoints in Django code also work, but not usually. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to display is better?
i have a queryset with 100 recoders, there are 20 recoders with "stick=True". so i want to display these 20 recoder first,then display other 80 recordes. my question is: 1. i can write to for loop in templates, so display 20 first, then display 80 with if clause. 2. i get 2 queryset in view.py, one for 20 recoders, the other for 80 recoders, then display separtely in templates file. which is better so performance? do you have other suggestion for displaying such recoders? thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---