how to use a customized logging formatter class

2012-10-20 Thread Ali
I have written this custom formatter which inherits from logging.Formatter, how can I configure logging settings so that I can use this for a logger. I see the example in docs where I can update the formatter string but dont know how to link a class to do that. class

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Christophe Pettus
On Oct 20, 2012, at 11:34 PM, Barry Morrison wrote: > Looking further at Postgresql, what's interesting. Is it creates an 'id' > column and appends '_id' to what is assumed to be the id field (if none is > specified). > > Also, it appears the magic may have already created the indexes:

Geometry vs Geography Data Type for PostGIS PostgreSQL database

2012-10-20 Thread JJ Zolper
Hello, So I've been researching the pros and cons for my application with regards to geometry or geography data types for my database. I was reading here: http://postgis.refractions.net/documentation/manual-1.5/ch04.html#PostGIS_GeographyVSGeometry I saw that: "The new GEOGRAPHY type allows

Re: Django Troubleshooting

2012-10-20 Thread Amyth Arora
Yeah, those are CLI commands. Although "tar" and "sudo" would not work with windows as they are linux terminal commands. you may follow this easy step by step procedure on how to setup django on windows. Though this was written for windows 7

Re: "Error: unable to open database file" when trying out the Django tutorial

2012-10-20 Thread Amyth Arora
change 'NAME': 'E:/Users/python/mysite/mysite.db', to 'NAME': 'mysite.db', and then try. If that does not work, delete the database file and do python manage.py syncdb again. On Fri, Oct 19, 2012 at 11:22 AM, Hamed Tohidloo wrote: > I am getting the exact same error . did

Re: Django shopping cart example

2012-10-20 Thread Amyth Arora
Try this $(document).ajaxSend(function(event, xhr, settings) { function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) {

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Barry Morrison
Looking further at Postgresql, what's interesting. Is it creates an 'id' column and appends '_id' to what is assumed to be the id field (if none is specified). Also, it appears the magic may have already created the indexes: django_db=# \d press_page Table

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Barry Morrison
Here is what exists in Dev re: Query Plan from debug toolbar: QUERY PLAN Sort (cost=8.28..8.28 rows=1 width=740)Sort Key: pgnumber -> Index Scan using press_page_article_id_like on press_page (cost=0.00..8.27 rows=1 width=740)Index Cond: ((article_id)::text = 'Test'::text) On

GeometryField.geography = True Syntax Help GIS Model

2012-10-20 Thread JJ Zolper
Hello everyone, So I've decided for my GeoDjango application I want WGS84 along with a geography database column, rather than geometry. I was reading here: https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography

Re: View for getting field based on value from another field

2012-10-20 Thread Tomas Jacobsen
Thank you! kl. 20:48:27 UTC+2 torsdag 18. oktober 2012 skrev Dennis Lee Bieber følgende: > > On Thu, 18 Oct 2012 03:03:17 -0700 (PDT), Tomas Jacobsen > declaimed the following in > gmane.comp.python.django.user: > > > Hello! > > > > I have a account model, which

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Barry Morrison
prefetch-related is awesome! Thank you for that. Thanks! Barry On Fri, Oct 19, 2012 at 11:54 PM, Xavier Ordoquy wrote: > Hi, > > As Samuel said, the first step is to install Django Debug Toolbar to see > what's going on with your queries. > Then you'll probably be

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Barry Morrison
I am using Django Debug Toolbar locally for development. That is where I copied & pasted the SQL from. Even if I had a complete set of data for postgresql, my local machine is an 8-core, 16GB of RAM, with solid state hard drives. A LOT different than my 2CPU/1GB RAM/spindle disk VPS. I guess

Re: ImportError: Could not import settings

2012-10-20 Thread sri
Hi Tom, Thanks very much.That solved the problem after removing that import. Sreekanth On Saturday, 20 October 2012 12:05:41 UTC+1, Tomáš Ehrlich wrote: > > Hello, > there's a little hint at the end of exception: > > > No module named unipath > > Seems like you import module unipath in your

Re: ImportError: Could not import settings

2012-10-20 Thread Tomas Ehrlich
Hello, there's a little hint at the end of exception: > No module named unipath Seems like you import module unipath in your settings.py, which is not on your sys.path. I never set PYTHONPATH for development and everything works fine. Python adds current directory to sys.path, so when you run

ImportError: Could not import settings

2012-10-20 Thread sri
Hi, I am trying to develop an sample project in Django and getting errors when i run syncdb command. This is how my project structure looks like: /Users/Sreek/django_demo/godjango/bookings: manage.py registration/

Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Xavier Ordoquy
Hi, As Samuel said, the first step is to install Django Debug Toolbar to see what's going on with your queries. Then you'll probably be interested in https://docs.djangoproject.com/en/1.4/ref/models/querysets/#prefetch-related Regards, Xavier Ordoquy, Linovia. Le 20 oct. 2012 à 05:16, Barry