Re: Мобильная версия

2010-08-27 Thread Lachlan Musicman
according to google:

I can not understand how best to implement the definition of what a person
gone now, with mobile, and that I need to shove him to the mobile
version?
Maybe someone already implement these moments?


It's a drunk russian beat poet that's lost his or her way, just ignore them.

2010/8/27 Олег Корсак :
> English?
>
> 27.08.2010 04:42, Vanger - irk пишет:
>> не могу понять, как лучше реализовать определение того, что человек
>> зашел сейчас с мобилы, и что мне нужно подсунуть ему мобильную
>> версию ?
>> Может быть кто-то уже реализовывал эти моменты?
>>
>
>



-- 
These simple functions belong to a sub-class known as strictly
dominating functions, meaning that their output is always bigger than
their inputs. A striking fact, known as the complementation theorem,
holds for all such functions. It says there is always an infinite
collection of inputs that when fed into the function will produce a
collection of outputs that is precisely the non-inputs.
- http://bit.ly/d3Fsrw

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



Re: Мобильная версия

2010-08-27 Thread Lachlan Musicman
2010/8/27 Lachlan Musicman :
> It's a drunk russian beat poet that's lost his or her way, just ignore them.

That come out wrong on re reading. I didn't mean to offend if I did, apols.

>
> 2010/8/27 Олег Корсак :
>> English?
>>
>> 27.08.2010 04:42, Vanger - irk пишет:
>>> не могу понять, как лучше реализовать определение того, что человек
>>> зашел сейчас с мобилы, и что мне нужно подсунуть ему мобильную
>>> версию ?
>>> Может быть кто-то уже реализовывал эти моменты?
>>>
>>
>>
>
>
>
> --
> These simple functions belong to a sub-class known as strictly
> dominating functions, meaning that their output is always bigger than
> their inputs. A striking fact, known as the complementation theorem,
> holds for all such functions. It says there is always an infinite
> collection of inputs that when fed into the function will produce a
> collection of outputs that is precisely the non-inputs.
> - http://bit.ly/d3Fsrw
>



-- 
These simple functions belong to a sub-class known as strictly
dominating functions, meaning that their output is always bigger than
their inputs. A striking fact, known as the complementation theorem,
holds for all such functions. It says there is always an infinite
collection of inputs that when fed into the function will produce a
collection of outputs that is precisely the non-inputs.
- http://bit.ly/d3Fsrw

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



Re: how to turn off CSRF in django 1.2?

2010-08-27 Thread Reinout van Rees

On 08/26/2010 05:33 PM, Alan wrote:

Ops, sorry, but I don't have this line
django.middleware.csrf.CsrfViewMiddleware, as I said, it's a project
done in 1.0.2. and I want it to run on my django 1.2 but without any
reference to Csrf, since the server where the portal is runs 1.0.2
yet.


You could also attempt it the other way around.

If I remember correctly, they added a "dummy" {% csrf %} tag to 1.1.x 
that doesn't really do anything.  So a form that works with 1.2 also 
works with 1.1 without throwing errors.


You could see if that's available/portable for 1.0, too.  Otherwise, a 
template tag that hacks this is quick to make yourself, I'd guess.



Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Re: order of middleware

2010-08-27 Thread Reinout van Rees

On 08/26/2010 07:08 PM, Alessandro Ronchi wrote:

Is this middleware classes correctly ordered for performance?
thanks in advance,

MIDDLEWARE_CLASSES = (


"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.doc.XViewMiddleware",
'django.middleware.gzip.GZipMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'pagination.middleware.PaginationMiddleware',
"django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',


I don't know about performance, but at least the GZipMiddleware 
documentation says it has to be right at the top to prevent errors.  It 
mucks about with the content-length, that's why.


By the way: have you already optimised the non-django-view parts of your 
application?  Combined js; combined css; static hosting of media files 
by apache/ngnix; perhaps a varnish cache; etc.


Optimizing *there* might bring more returns than a heaping amount of 
middleware.



Reinout


--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Re: Template not found

2010-08-27 Thread Reinout van Rees

On 08/26/2010 09:11 PM, Bradley Hintze wrote:

Got it!


You're keeping us all in suspense :-)

Next time, could you add a one-line summary of the eventual solution? 
There will be people with similar problems that google your post in 
2012.  They'll want more than a "got it" :-)



Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Re: Problems loading static files on runserver (I mean images and css)

2010-08-27 Thread Reinout van Rees

On 08/27/2010 08:58 AM, Karim Gorjux wrote:


My doubt is in these 3 variables. How I have to use they?

MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'


A bit of copy/paste from my settings.py:

# Absolute path to the directory that holds user-uploaded media.
MEDIA_ROOT = '/path/to/your/media/dir'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
MEDIA_URL = '/media/'


Another question. In the template how I have to refer to the files? I
have just 2: "style.css" and "header.jpg" that are located in
"/Users/karim/Projects/simplesite/template/media"


That'd have to be the value of MEDIA_ROOT, then.  The MEDIA_URL is 
traditionally /media/, but you can really pick anything.



Is these code right?






I'd put a slash in front of "media".

Even better would be:



(Note the lack of a slash after {{ MEDIA_URL }}, btw).

For those {{ MEDIA_URL }}-like urls to work you need to use the 
RequestContext, see http://tinyurl.com/yllym5h




Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Re: Problems loading static files on runserver (I mean images and css)

2010-08-27 Thread bruno desthuilliers
On 27 août, 08:58, Karim Gorjux  wrote:
> As I read herehttp://docs.djangoproject.com/en/dev/howto/static-files/I
> configure the settings.py and the urls.py to load a template in runserver.
>
> ## urls.py ##
>
> from django.conf import settings
>
> [...]
>
>     (r'^media/(?P.*)$', 'django.views.static.serve',
>             {'document_root': 'settings.STATIC_DOC_ROOT'}),
>
> ## end of urls.py ##
>
> ## settings.py ##
> [...]
> STATIC_DOC_ROOT = '/Users/karim/Projects/simplesite/template/media/'

Why using a non-standard setting when there's a standard one ?


Here's (once again) an extract from our standard dev settings.py:

###
import sys, os.path, os

# so we don't have to hard-code this...
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))

SITE_URL = "http://127.0.0.1:8000";

DEBUG = True
TEMPLATE_DEBUG = True
DEV_SERVER = True

# name of the directory that holds medias
MEDIA_DIR = "medias"

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, MEDIA_DIR)

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com";, "http://example.com/media/";

MEDIA_URL = "%s/%s/" % (SITE_URL, MEDIA_DIR)

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# XXX : and make sure to avoid collisions with site media (MEDIA_DIR /
MEDIA_URL) -
# you can't have both served from the same url !-)
# Simplest solution is to make sure you DONT use '/media/' as
ADMIN_MEDIA_PREFIX
# Examples: "http://foo.com/media/";, "/media/".

ADMIN_MEDIA_PREFIX = '/admin-media/'
###


Also, you need to enable the "django.core.context_processors.media" in
your TEMPLATE_CONTEXT_PROCESSORS setting, and use  {{ MEDIA_URL }} in
your templates, ie :

  




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



Re: Problems loading static files on runserver (I mean images and css)

2010-08-27 Thread Karim Gorjux
On Fri, Aug 27, 2010 at 10:57, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:

>
>
Thanks a lot for all your advices. I work a lot on settings.py and now is
more professional. The mistake was in

ADMIN_MEDIA_PREFIX = '/media/'

I changed it in

ADMIN_MEDIA_PREFIX = '/admin-media/'

And everything works now.

Thanks!

-- 
Karim Gojux
www.karimblog.net

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



Re: Template not found

2010-08-27 Thread Steve Holden
On 8/27/2010 3:41 AM, Reinout van Rees wrote:
> On 08/26/2010 09:11 PM, Bradley Hintze wrote:
>> Got it!
> 
> You're keeping us all in suspense :-)
> 
> Next time, could you add a one-line summary of the eventual solution?
> There will be people with similar problems that google your post in
> 2012.  They'll want more than a "got it" :-)
> 
Or at least give us some hintze ... sorry, you'll have heard that one a
million times before.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



save() isn't thread-safe?

2010-08-27 Thread Andy
In this presentation save() is described as not thread-safe and
update() is recommended to be used instead of save():

http://www.slideshare.net/zeeg/db-tips-tricks-django-meetup  (page
2, 3, 4)

Is it true that save() is not thread-safe? How is it not? Should I
avoid using save() and use update() instead?

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



"unknown command" from almost all admin commands

2010-08-27 Thread bluearth
Hi,

I'm trying to have multiple configuration files for my project as
described in http://www.djangobook.com/en/2.0/chapter12/.

I always get the following when issuing administrative commands (for
example):

# ./manage.py --settings=harmony.settings_dev syncdb
Unknown command: '--settings'
Type 'django-admin help' for usage.
#

Seems that only --help and --version works as expected. others give me
"unknown command"

I'm not sure if i have missed something here.

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



google projection GeoDjango question

2010-08-27 Thread maraujop
Hi everyone,

I'm new to GeoDjango. After installing it and test it. I have created
a model called Spot which gas a Geography SRID 4326 PointField.

class Spot(models.Model):
point = models.PointField(spatial_index = True,
srid = 4326,
geography = True)

objects = models.GeoManager()

I have activated Open Street Maps admin interface. The points I get
come from Google geocode API, I'm using geopy library for this. So I
guess they are in 900913. My problem is that points like (40,-3) that
are in Spain are being showed in the cost of Kenya. So I guess I'm
doing something wrong. I was not sure if this map supported 900913 so
I tried this: 
http://taylanpince.com/blog/posts/adding-geolocation-support-to-geodjango-admin/#comments

But it kept doing the same thing. Any help on this?

Thanks, best regards
Miguel Araujo

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



Re: order of middleware

2010-08-27 Thread Alessandro Ronchi
2010/8/27 Reinout van Rees 

>
> I don't know about performance, but at least the GZipMiddleware
> documentation says it has to be right at the top to prevent errors.  It
> mucks about with the content-length, that's why.
>

So, I should put it before commonMiddleware?


> By the way: have you already optimised the non-django-view parts of your
> application?  Combined js; combined css; static hosting of media files by
> apache/ngnix; perhaps a varnish cache; etc.
>
> Optimizing *there* might bring more returns than a heaping amount of
> middleware.


Yes, I've varnish and I use a minimizer to combine and compress js and css.

Thank you!



-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

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



Re: how to turn off CSRF in django 1.2?

2010-08-27 Thread Alan
Thanks João, indeed, after reading the link, what I needed was to
*add* it. So now I have:

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.csrf.middleware.CsrfMiddleware',
)

And everything seems to be working fine.

Alan

On 26 Aug, 17:50, João Rodrigues  wrote:
> what about 'django.contrib.csrf.middleware.CsrfMiddleware' 
> ?http://docs.djangoproject.com/en/1.0/ref/contrib/csrf/#how-to-use-it
>
> On 26 August 2010 16:33, Alan  wrote:
>
>
>
>
>
> > Ops, sorry, but I don't have this line
> > django.middleware.csrf.CsrfViewMiddleware, as I said, it's a project
> > done in 1.0.2. and I want it to run on my django 1.2 but without any
> > reference to Csrf, since the server where the portal is runs 1.0.2
> > yet.
>
> > On 26 Aug, 15:54, João Rodrigues  wrote:
> > > go to your settings.py and comment out
> > > django.middleware.csrf.CsrfViewMiddleware in your MIDDLEWARE_CLASSES
>
> > > On 26 August 2010 10:33, Alan  wrote:
>
> > > > Hi there,
>
> > > > I developed in a system that uses django 1.2, but the server is still
> > > > django 1.0.2.
>
> > > > Upgrading for a moment is not possible. Unless someone knows a nice
> > > > simple alternative, in order to keep my web portal compatible between
> > > > 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> > > > computer.
>
> > > > How can I do this simply and easily?
>
> > > > Many thanks,
>
> > > > Alan
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com > > >  groups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-27 Thread Karen Tracey
On Thu, Aug 26, 2010 at 11:09 PM, The Boss  wrote:

> This should really be much easier.


I generally do something like:

class OrderForm(ModelForm):
def __init__(self, *args, **kw):
ordernumber = '%06d' % kw.pop('ordernumber', 0)
super(OrderForm, self).__init__(*args, **kw)
self.fields['associated_files'].queryset =
ArchivedFile.objects.filter(name__startswith=str(ordernumber))

(Untested for your particular example, but this general approach is one I've
used often.)

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

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



Re: google projection GeoDjango question

2010-08-27 Thread Miguel Araujo
After 3 days trying to solve this, I found that geopy returns
latitude/longitude and GEOS expects coordinates in reversed order. This
fixes my issue with the maps.

Thanks though,
Miguel Araujo

2010/8/27 maraujop 

> Hi everyone,
>
> I'm new to GeoDjango. After installing it and test it. I have created
> a model called Spot which gas a Geography SRID 4326 PointField.
>
> class Spot(models.Model):
>point = models.PointField(spatial_index = True,
>srid = 4326,
>geography = True)
>
>objects = models.GeoManager()
>
> I have activated Open Street Maps admin interface. The points I get
> come from Google geocode API, I'm using geopy library for this. So I
> guess they are in 900913. My problem is that points like (40,-3) that
> are in Spain are being showed in the cost of Kenya. So I guess I'm
> doing something wrong. I was not sure if this map supported 900913 so
> I tried this:
> http://taylanpince.com/blog/posts/adding-geolocation-support-to-geodjango-admin/#comments
>
> But it kept doing the same thing. Any help on this?
>
> Thanks, best regards
> Miguel Araujo

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



Re: Problems loading static files on runserver (I mean images and css)

2010-08-27 Thread bruno desthuilliers
On 27 août, 10:24, Karim Gorjux  wrote:
> On Fri, Aug 27, 2010 at 10:57, bruno desthuilliers <
>
> bruno.desthuilli...@gmail.com> wrote:
>
> Thanks a lot for all your advices. I work a lot on settings.py and now is
> more professional. The mistake was in
>
> ADMIN_MEDIA_PREFIX = '/media/'
>
> I changed it in
>
> ADMIN_MEDIA_PREFIX = '/admin-media/'
>
> And everything works now.
>

Yeps, that's a common gotcha, and the combination of default value of
ADMIN_MEDIA_PREFIX and the examples in the comments for MEDIA_URL
doesn't 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: save() isn't thread-safe?

2010-08-27 Thread Karen Tracey
On Fri, Aug 27, 2010 at 5:07 AM, Andy  wrote:

> In this presentation save() is described as not thread-safe and
> update() is recommended to be used instead of save():
>
> http://www.slideshare.net/zeeg/db-tips-tricks-django-meetup  (page
> 2, 3, 4)
>
> Is it true that save() is not thread-safe? How is it not? Should I
> avoid using save() and use update() instead?
>

It's a matter of what your code is doing. While you can write code using
save() in a way that is not thread-safe, you do not necessarily need to
switch to update() to fix the issue. Consider code like this in a view:

for answer in chosen_answers:
answer.votes += 1
answer.save()

That is not thread-safe. Running on a production web server, that block of
code may be simultaneously running to handle multiple different requests.
Incrementing the vote count in the view, based on whatever was read earlier
and may now be stale, runs the risk of losing votes. A thread-safe version
is:

from django.db.models import F
for answer in chosen_answers:
answer.votes = F('votes') + 1
answer.save()

The use of an F() expression (
http://docs.djangoproject.com/en/dev/ref/models/instances/#updating-attributes-based-on-existing-fields)
will push the responsibility for ensuring the value is atomically updated
onto the database.

(Example code taken from the book you can find by following the link in my
sig...there are more details of how to test for such issues in the book.)

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

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



Re: Мобильная версия

2010-08-27 Thread Ковалевич
Question was: how to determine that user comes from mobile phone to show him
mobile version of site. May be by parsing user agent. (for example
http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones)

2010/8/27 Lachlan Musicman 

> That come out wrong on re reading. I didn't mean to offend if I did, apols.




-- 
Best Regards,
Mila

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



Re: "unknown command" from almost all admin commands

2010-08-27 Thread bruno desthuilliers
On 27 août, 05:51, bluearth  wrote:
> Hi,
>
> I'm trying to have multiple configuration files for my project as
> described inhttp://www.djangobook.com/en/2.0/chapter12/.
>
> I always get the following when issuing administrative commands (for
> example):
>
> # ./manage.py --settings=harmony.settings_dev syncdb
> Unknown command: '--settings'
> Type 'django-admin help' for usage.
> #
>
> Seems that only --help and --version works as expected. others give me
> "unknown command"
>
> I'm not sure if i have missed something here.

First point, "--settings" is an option, not a command. Second point,
the correct usage (as documented) is "manage.py subcommand [options]
[args]".

IOW, you want:
# ./manage.py syncdb --settings=harmony.settings_dev

HTH

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



Re: "unknown command" from almost all admin commands

2010-08-27 Thread Ковалевич
according documentation
http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs
Generally, when working on a single Django project, it’s easier to use
manage.py. Use django-admin.py with DJANGO_SETTINGS_MODULE, or the
--settings command line option, if you need to switch between multiple
Django settings files.
.

On 27 August 2010 15:04, bruno desthuilliers
wrote:

> On 27 août, 05:51, bluearth  wrote:
> > Hi,
> >
> > I'm trying to have multiple configuration files for my project as
> > described inhttp://www.djangobook.com/en/2.0/chapter12/.
> >
> > I always get the following when issuing administrative commands (for
> > example):
> >
> > # ./manage.py --settings=harmony.settings_dev syncdb
> > Unknown command: '--settings'
> > Type 'django-admin help' for usage.
> > #
> >
> > Seems that only --help and --version works as expected. others give me
> > "unknown command"
> >
> > I'm not sure if i have missed something here.
>
> First point, "--settings" is an option, not a command. Second point,
> the correct usage (as documented) is "manage.py subcommand [options]
> [args]".
>
> IOW, you want:
> # ./manage.py syncdb --settings=harmony.settings_dev
>
> HTH
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Best Regards,
Mila

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



Get request path without having a request object

2010-08-27 Thread Sells, Fred
I've looked at http://www.djangobook.com/en/beta/chapter12/ and the
section on Using sessions outside of views which shows:

>>> from django.contrib.sessions.models import Session
>>> s =
Session.objects.get_object(pk='2b1189a188b44ad18c35e113ac6ceead')

But where does that pk come from?

I'm down deep in my module hierarchy and find I need a custom user
object that I stored in my session.  I'm not using Django Authentication
because I'm running behind a legacy system that already does all that
and I had to be compatible.

I'm not sure of the thread safety of Django and wonder if I could store
this object as a local variable of some module like

>From mysite.myapp import myPersistantStorage

myPersistantStorage.myUserObject = request.session['user']

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



Re: order of middleware

2010-08-27 Thread Reinout van Rees

On 08/27/2010 12:43 PM, Alessandro Ronchi wrote:



2010/8/27 Reinout van Rees mailto:rein...@vanrees.org>>


I don't know about performance, but at least the GZipMiddleware
documentation says it has to be right at the top to prevent errors.
  It mucks about with the content-length, that's why.


So, I should put it before commonMiddleware?


At the top is at the top :-)  See the docs:

http://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.gzip


Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Refer to an object directly from code or API/curl

2010-08-27 Thread Alexandre González
Hi!

I have 2 models in my program, and I like to refer to one of them withou
getting the object "manually".

As I have writted them, I can do curl -F languages="es, en, it" and then the
get_languages method split by comma and get the objects, but... can I
directly send from the API the correct language object without do this?

Os some better method to do that?

For example..
example=Example()
examples.language=Language.objects.get(code='es')

A better way to do this?

class Example(models.Model):
language = models.ManyToManyField(Language)
...


class Language(models.Model):
code = models.CharField(max_length=12, primary_key=True, blank=False,
help_text=_('Example: en, es...'))
name = models.CharField(max_length=64, blank=False, help_text=_('The
real name.'))

def get_language(self, code):
try:
return Language.objects.get(code=code)
except Language.DoesNotExist:
return None

def get_languages(self, codes):
languages = list()

for code in codes.split(','):
language_object = self.get_language(code)
if language_object: languages.append(language_object)

return languages



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

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



Re: Template not found

2010-08-27 Thread Bradley Hintze
Figured it out. But still 'gr!'

So whenever I change a file and save it the stupid computer
automatically changes ownership back to me instead of keeping www as
owner. Thus apache couldn't 'see' my ne settings. As admin being the
group with read/write permissions I thought that I could change the
file no problem, specifically I assumed ownership wouldn't change.  Is
this a probleem that someone can help me with?

On Fri, Aug 27, 2010 at 11:21 AM, Bradley Hintze
 wrote:
> LOL and grr,
>
> I wish I had posted my solution. I'm getting the same error,
> TemplateDoesNotExist. I look at my settings for my template directory,
> look in that directory and there is the template that it says does not
> exist! Very frustrating! I did move my directory but (thought) I
> changed all the requisite absolute paths. Any ideas? I'll let you know
> what I find if I find anything at all.
>
> Bradley
>
> On Fri, Aug 27, 2010 at 4:58 AM, Steve Holden  wrote:
>> On 8/27/2010 3:41 AM, Reinout van Rees wrote:
>>> On 08/26/2010 09:11 PM, Bradley Hintze wrote:
 Got it!
>>>
>>> You're keeping us all in suspense :-)
>>>
>>> Next time, could you add a one-line summary of the eventual solution?
>>> There will be people with similar problems that google your post in
>>> 2012.  They'll want more than a "got it" :-)
>>>
>> Or at least give us some hintze ... sorry, you'll have heard that one a
>> million times before.
>>
>> regards
>>  Steve
>> --
>> DjangoCon US 2010 September 7-9 http://djangocon.us/
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

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



Re: Get request path without having a request object

2010-08-27 Thread David De La Harpe Golden
On 27/08/10 14:22, Sells, Fred wrote:

> I'm not sure of the thread safety of Django and wonder if I could store
> this object as a local variable of some module like

No, that is not likely to work except in a single-threaded* context, and
even then it's a bit fraught (just being single-threaded still doesn't
mean each request is handled by a _new_ process, if you're not careful
you could leave things set to values from old requests).

There is a recipe out there for using a django middleware that uses
thread-local variables to stash info from the django request [1], but
that also tends to be frowned upon by django people for a variety of
reasons [2].

Python, while obviously somewhat lisp-oid, also doesn't have lisp-like
dynamics that might be idiomatic in lisp land.

Sooo just give up and explicitly pass the datum you want down
through the call chain. That can be a pain, but at least python has the
*args/**kwargs mechanism that can make it fairly easy for one callable
to just pass on through unused kwargs to another (a pattern used quite a
bit in django itself).

(* aside: single-threaded multiple-process serving is often a viable
option for serving stuff, at least on linux, where processes are very
cheap, and does avoid threading issues nicely (remember ordinary python
2.x can be kinda sucky threading-wise anyway [3]). Ex-windows people on
linux/unix often jump to threading very prematurely, mistakenly
generalising from windows [4])


[1] http://djangosnippets.org/snippets/1605/
[2] http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
[3] http://en.wikipedia.org/wiki/Global_Interpreter_Lock
[4]
http://stackoverflow.com/questions/47845/why-is-creating-a-new-process-more-expensive-on-windows-than-linux

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



Pass extra data in post_save?

2010-08-27 Thread AK
>From what I can tell in the documentation, a post_save signal only
passes sender, instance, created, and using.  I would love to use this
signal to update information in the instance, such as the datetime of
when it was saved.  This would be fine, except that I want to also
keep track of the user who made the save (from request.user).  What is
the best way to get this information to a post-save signal?

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



Re: Template not found

2010-08-27 Thread Bradley Hintze
LOL and grr,

I wish I had posted my solution. I'm getting the same error,
TemplateDoesNotExist. I look at my settings for my template directory,
look in that directory and there is the template that it says does not
exist! Very frustrating! I did move my directory but (thought) I
changed all the requisite absolute paths. Any ideas? I'll let you know
what I find if I find anything at all.

Bradley

On Fri, Aug 27, 2010 at 4:58 AM, Steve Holden  wrote:
> On 8/27/2010 3:41 AM, Reinout van Rees wrote:
>> On 08/26/2010 09:11 PM, Bradley Hintze wrote:
>>> Got it!
>>
>> You're keeping us all in suspense :-)
>>
>> Next time, could you add a one-line summary of the eventual solution?
>> There will be people with similar problems that google your post in
>> 2012.  They'll want more than a "got it" :-)
>>
> Or at least give us some hintze ... sorry, you'll have heard that one a
> million times before.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9 http://djangocon.us/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

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



Re: Template not found

2010-08-27 Thread Steve Holden
On 8/27/2010 11:46 AM, Bradley Hintze wrote:
>> Figured it out. But still 'gr!'
>> 
>> So whenever I change a file and save it the stupid computer 
>> automatically changes ownership back to me instead of keeping www
>> as owner. Thus apache couldn't 'see' my ne settings. As admin being
>> the group with read/write permissions I thought that I could change
>> the file no problem, specifically I assumed ownership wouldn't
>> change.  Is this a probleem that someone can help me with?
>> 
The usual solution for this would be to use group permissions to give
the web server access to the files, since editing will normally only
change the user ownership and not the group ownership.

If group ownership also changes, use the sticky bit on directories,
which IIRC can set group ownership to follow the ownership of the
containing directory.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



model based on insertable database view has problems with last_insert_id

2010-08-27 Thread Benedykt
Hello,

I created a simple Django model based on some database view. It looks
like that:
class Person(models.Model):
name = models.CharField(max_length=200)
class Meta:
db_table = 'bambo_person_view'

In my database (Postgresql) I created this view and I gave it rules,
so it is possible to insert into this view, update it and delete from
it.

However, when I enter the admin panel and try to add a new person, I
got such exception:
(...)
  494. self.save_model(request, new_object, form,
change=False)
File "/var/lib/python-support/python2.5/django/contrib/admin/
options.py" in save_model
  376. obj.save()
File "/var/lib/python-support/python2.5/django/db/models/base.py" in
save
  311. self.save_base(force_insert=force_insert,
force_update=force_update)
File "/var/lib/python-support/python2.5/django/db/models/base.py" in
save_base
  383. result = manager._insert(values,
return_id=update_pk)
File "/var/lib/python-support/python2.5/django/db/models/manager.py"
in _insert
  138. return insert_query(self.model, values, **kwargs)
File "/var/lib/python-support/python2.5/django/db/models/query.py" in
insert_query
  894. return query.execute_sql(return_id)
File "/var/lib/python-support/python2.5/django/db/models/sql/
subqueries.py" in execute_sql
  312. self.model._meta.db_table,
self.model._meta.pk.column)
File "/var/lib/python-support/python2.5/django/db/backends/postgresql/
operations.py" in last_insert_id
  58. cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" %
(table_name, pk_name))
File "/var/lib/python-support/python2.5/django/db/backends/util.py" in
execute
  19. return self.cursor.execute(sql, params)

As you can see, after succesfull insert, Django calls function
last_insert_id. This function takes a look at the sequence
bambo_person_view_id_seq, which does not exist. If I could force it to
look at the proper sequence - I mean, bambo_person_id_seq - everything
would be ok. But I can't find the way to force it.

What can I do? What is the official way of using insertable database
views in Django?

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



Re: App for Registration/Authorization which is Email & Password based (not username)

2010-08-27 Thread Eric Chamberlain

On Aug 26, 2010, at 9:31 PM, nobosh wrote:

> Hello, I'm on day 7 learning Django and would appreciate any info
> around getting my Django app started with a Registration/Authorization
> which is Email & Password based (not username). I'll don't currently
> have a need for usernames. Is there an app or a clean/smart way to
> implement. I'm trying to avoid bad habits as this is my first step
> after reading the book.
> 

We've done a few apps that use email for auth.  In some cases, we generate a 
random 30-character username, the odds of a collision are very low and we don't 
run into issues trying to truncate an email address so it will conform to the 
username field character and length requirements.  In other cases, where we 
need a deterministic username, we base64 encode a UUID for the username.

We try to not tie the username to a derivative of the email address, so we can 
avoid username collisions if the user changes their email address.

Don't forget to add an index to the email field.

--
Eric Chamberlain, Founder
RF.com - http://RF.com/







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



Django persistent database(postgres) connection.

2010-08-27 Thread jai_python
Hi friends,
My django application runs in red hat server  with apache &
mod_wsgi. We have several request which interacts with
database(postgresql), so database interaction is huge. i found that
every time django application establishing a new connection to
interact with DB. So my server hanging often due to large number of DB
connection (approximately some 200-250 connection/minute, it may
increase gradually)
Its very urgent. Hope I will get support here
Thanks for looking my thread.


Thanks & Regards,
Jayapal D

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



images in sitemap.xml

2010-08-27 Thread Alessandro Ronchi
I want to add my images on sitemap objects:
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636

is it possible with sitemap framework?
how?

-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

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



variable name spaces

2010-08-27 Thread Bradley Hintze
Ok, I hope I can explain my problem coherently :).

In development I ran my web app fine. I have now put it in production
(configured and running on apache). In my views.py file I passed
global variables between different functions (views) beautifully
during development (manage.py runserver). However, when I run it on
apache it seems, from the error page (i have debug on), that I cannot
pass global variables between view.py functions (maybe apache 'calls'
a fresh 'instance' of views.py making the old variables 'unavailable'
(please excuse any errors in my attempts to use correct vocabulary).
Does this mak sense? if so, Is there a way around this such that I can
use variables created in on view function in another?

Bradley

-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

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



Re: variable name spaces

2010-08-27 Thread Steve Holden
On 8/27/2010 2:07 PM, Bradley Hintze wrote:
> Ok, I hope I can explain my problem coherently :).
> 
> In development I ran my web app fine. I have now put it in production
> (configured and running on apache). In my views.py file I passed
> global variables between different functions (views) beautifully
> during development (manage.py runserver). However, when I run it on
> apache it seems, from the error page (i have debug on), that I cannot
> pass global variables between view.py functions (maybe apache 'calls'
> a fresh 'instance' of views.py making the old variables 'unavailable'
> (please excuse any errors in my attempts to use correct vocabulary).
> Does this mak sense? if so, Is there a way around this such that I can
> use variables created in on view function in another?
> 
> Bradley
> 
In testing, it's most unlikely that different requests will be handled
by different processes. In production this is more or less inevitable.

If you want data to be accessible over time (and I presume you want each
user to have their own values associated with the global variable?) you
need to store the data in the session object. The server maintains a
separate session for each originating IP address (I think - close enough
for a beginner, anyway), so data from different users does not get mixed up.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



starting with django project

2010-08-27 Thread lakshay pushkarna
hi,

when i write the command at the time of creating a new directory for
starting a project with the command:
-> django-admin.py startproject mysite

It shows me an error of the core module 's unavailability,

->Traceback (most recent call last):
  File "/usr/bin/django-admin.py", line 2, in 
from django.core import management
ImportError: No module named django.core

Even though the core directory is present in the django-trunk/django/, why
is it not being able to import it ?

thanks
regards lakshay

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



Re: question on directory structure for deploying project

2010-08-27 Thread Joel Klabo
bmp

On Aug 26, 8:14 pm, Joel Klabo  wrote:
> Could someone just show me how theirs is set up?
>
> On Aug 26, 4:54 pm, Joel Klabo  wrote:
>
>
>
>
>
>
>
> > It does have __init__.py, but not the server isn't seeing it... '500
> > internal server error'
>
> > On Aug 26, 4:48 pm, Kenneth Gonsalves  wrote:
>
> > > On Thu, 2010-08-26 at 16:44 -0700, Joel Klabo wrote:
> > > > also, when I change the virtual host path to: /srv/www/brooski.net
> > > > (instead of /srv/www/brooski.net/brooski/) I get an internal server
> > > > error. Whereas with '/srv/www/brooski.net/brooski/' I get the actual
> > > > django error page
>
> > > the question is that does brooski directory have an __init__.py file in
> > > it. If so, It should not be on the path - only the parent directory
> > > should be in the path.
> > > --
> > > regards
> > > Kenneth Gonsalves

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



Re: App for Registration/Authorization which is Email & Password based (not username)

2010-08-27 Thread Alexandre González
I've using django-registration to do that...

class RegistrationFormTOSAndUniqueEmail(RegistrationFormTermsOfService,
RegistrationFormUniqueEmail):
def __init__(self, *args, **kwargs):
super(RegistrationFormTOSAndUniqueEmail, self).__init__(*args, **kwargs)

def clean_email(self):
self.cleaned_data['username'] = md5(self.cleaned_data['email'] +
str(time.time())).hexdigest()
return super(RegistrationFormTOSAndUniqueEmail, self).clean_email()

It's little "complicated" because I like to reg with mail and I like to show
the Terms Of Service.

At clean_email I'm creating a hash to save as unique in the username field.

I can help you more if you like, but I did this lot of time ago... it's
complicated :p But django-registration is very good documented

On Fri, Aug 27, 2010 at 18:59, Eric Chamberlain  wrote:

>
> On Aug 26, 2010, at 9:31 PM, nobosh wrote:
>
> > Hello, I'm on day 7 learning Django and would appreciate any info
> > around getting my Django app started with a Registration/Authorization
> > which is Email & Password based (not username). I'll don't currently
> > have a need for usernames. Is there an app or a clean/smart way to
> > implement. I'm trying to avoid bad habits as this is my first step
> > after reading the book.
> >
>
> We've done a few apps that use email for auth.  In some cases, we generate
> a random 30-character username, the odds of a collision are very low and we
> don't run into issues trying to truncate an email address so it will conform
> to the username field character and length requirements.  In other cases,
> where we need a deterministic username, we base64 encode a UUID for the
> username.
>
> We try to not tie the username to a derivative of the email address, so we
> can avoid username collisions if the user changes their email address.
>
> Don't forget to add an index to the email field.
>
> --
> Eric Chamberlain, Founder
> RF.com - http://RF.com/
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

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



Re: starting with django project

2010-08-27 Thread Simone Dalla
2010/8/27 lakshay pushkarna 

> hi,
>
> when i write the command at the time of creating a new directory for
> starting a project with the command:
> -> django-admin.py startproject mysite
>
> It shows me an error of the core module 's unavailability,
>
> ->Traceback (most recent call last):
>   File "/usr/bin/django-admin.py", line 2, in 
> from django.core import management
> ImportError: No module named django.core
>
> Even though the core directory is present in the django-trunk/django/, why
> is it not being able to import it ?
>
>
Your Django installation isn't into PYTHON path.

-- 
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free  --> Linus B. Torvalds

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



Re: Django persistent database(postgres) connection.

2010-08-27 Thread Timothy Makobu
Hi,
just a suggestion; try a different web-server system, like (uWSGI,
gunicorn)+nginx,
then if you haven't already, do everything on this wiki
http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server

see if that helps.

On Fri, Aug 27, 2010 at 8:17 PM, jai_python  wrote:

> Hi friends,
>My django application runs in red hat server  with apache &
> mod_wsgi. We have several request which interacts with
> database(postgresql), so database interaction is huge. i found that
> every time django application establishing a new connection to
> interact with DB. So my server hanging often due to large number of DB
> connection (approximately some 200-250 connection/minute, it may
> increase gradually)
> Its very urgent. Hope I will get support here
> Thanks for looking my thread.
>
>
> Thanks & Regards,
> Jayapal D
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: starting with django project

2010-08-27 Thread lakshay pushkarna
I have /usr/local/lib/python2.6/site-packages in my sys.path. i
symlinked the django-admin.py from the django-trunk directory , how
else should i put it into the python path

thanks



On Sat, Aug 28, 2010 at 12:04 AM, Simone Dalla  wrote:

>
>
> 2010/8/27 lakshay pushkarna 
>
> hi,
>>
>> when i write the command at the time of creating a new directory for
>> starting a project with the command:
>> -> django-admin.py startproject mysite
>>
>> It shows me an error of the core module 's unavailability,
>>
>> ->Traceback (most recent call last):
>>   File "/usr/bin/django-admin.py", line 2, in 
>> from django.core import management
>> ImportError: No module named django.core
>>
>> Even though the core directory is present in the django-trunk/django/, why
>> is it not being able to import it ?
>>
>>
> Your Django installation isn't into PYTHON path.
>
> --
> Simo
>
> - Registered Linux User #395060
>
> - Software is like sex, it is better when it is free  --> Linus B. Torvalds
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django persistent database(postgres) connection.

2010-08-27 Thread Peter Herndon

On Aug 27, 2010, at 1:17 PM, jai_python wrote:

> Hi friends,
>My django application runs in red hat server  with apache &
> mod_wsgi. We have several request which interacts with
> database(postgresql), so database interaction is huge. i found that
> every time django application establishing a new connection to
> interact with DB. So my server hanging often due to large number of DB
> connection (approximately some 200-250 connection/minute, it may
> increase gradually)
> Its very urgent. Hope I will get support here
> Thanks for looking my thread.
> 
> 
> Thanks & Regards,
> Jayapal D

Hi Jayapal,

What you want is a connection pool for Postgres.  Happily, such exists in the 
form of pgpool-2: http://pgpool.projects.postgresql.org/

The way it works is pgpool-2 runs as a separate daemon and spawns a 
configurable number of database connections.  You configure pgpool-2 to listen 
for incoming database connections on whatever port you prefer, 5433 for 
example, and you tell it to talk to your database on e.g. port 5432.  In your 
Django settings, you use the standard "postgresql_psycopg2" driver and tell it 
to connect to the database via port 5433.  Django then uses the pooled 
connections, and you don't have to worry about the overhead of setting up new 
connections or tearing down old ones.

Hope that helps,

---Peter

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



Re: starting with django project

2010-08-27 Thread lakshay pushkarna
was doing the sym-linking incorrectly, re-did  it , now its working :)

thanks
regards lakshay

On Sat, Aug 28, 2010 at 12:16 AM, lakshay pushkarna <
lakshaypushkarn...@gmail.com> wrote:

> I have /usr/local/lib/python2.6/site-packages in my sys.path. i symlinked the 
> django-admin.py from the django-trunk directory , how else should i put it 
> into the python path
>
> thanks
>
>
>
> On Sat, Aug 28, 2010 at 12:04 AM, Simone Dalla wrote:
>
>>
>>
>> 2010/8/27 lakshay pushkarna 
>>
>>  hi,
>>>
>>> when i write the command at the time of creating a new directory for
>>> starting a project with the command:
>>> -> django-admin.py startproject mysite
>>>
>>> It shows me an error of the core module 's unavailability,
>>>
>>> ->Traceback (most recent call last):
>>>   File "/usr/bin/django-admin.py", line 2, in 
>>> from django.core import management
>>> ImportError: No module named django.core
>>>
>>> Even though the core directory is present in the django-trunk/django/,
>>> why is it not being able to import it ?
>>>
>>>
>> Your Django installation isn't into PYTHON path.
>>
>> --
>> Simo
>>
>> - Registered Linux User #395060
>>
>> - Software is like sex, it is better when it is free  --> Linus B.
>> Torvalds
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

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



mod_python, apache and django

2010-08-27 Thread Jesse
I'm loading django onto Windows XP professional with Apache.
Unfortunately, I need mod_python which only works with python 2.3.
Django needs python 2.4 and above.  Is there a way around this?
Thx

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



Services Trade: Legal Work for help switching Django site to App Engine

2010-08-27 Thread Trendero.com
I have a site, trendero.com, built using Django and hosted with
RackSpace on its own server. To reduce costs, I'd like to switch the
hosting to App Engine, but I'm not a technical guy (had the site built
using contractors).

I practiced corporate law for four years at a well-known Silicon
Valley boutique law firm, and I know well the issues startups face. I
can document any kind of deal or offer advice in exchange for help
moving my site to App Engine.

Any interest?

NOTE: This was posted to HN here: http://news.ycombinator.com/item?id=1436719

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



Re: App for Registration/Authorization which is Email & Password based (not username)

2010-08-27 Thread nobosh
Thanks Alexandre, I also found this one: 
http://github.com/redvasily/django-emailauth

Given I'm a newbie, which path do you recommend I pursue?

On Aug 27, 11:33 am, Alexandre González  wrote:
> I've using django-registration to do that...
>
> class RegistrationFormTOSAndUniqueEmail(RegistrationFormTermsOfService,
> RegistrationFormUniqueEmail):
>     def __init__(self, *args, **kwargs):
>     super(RegistrationFormTOSAndUniqueEmail, self).__init__(*args, **kwargs)
>
>     def clean_email(self):
>         self.cleaned_data['username'] = md5(self.cleaned_data['email'] +
> str(time.time())).hexdigest()
>         return super(RegistrationFormTOSAndUniqueEmail, self).clean_email()
>
> It's little "complicated" because I like to reg with mail and I like to show
> the Terms Of Service.
>
> At clean_email I'm creating a hash to save as unique in the username field.
>
> I can help you more if you like, but I did this lot of time ago... it's
> complicated :p But django-registration is very good documented
>
>
>
>
>
> On Fri, Aug 27, 2010 at 18:59, Eric Chamberlain  wrote:
>
> > On Aug 26, 2010, at 9:31 PM, nobosh wrote:
>
> > > Hello, I'm on day 7 learning Django and would appreciate any info
> > > around getting my Django app started with a Registration/Authorization
> > > which is Email & Password based (not username). I'll don't currently
> > > have a need for usernames. Is there an app or a clean/smart way to
> > > implement. I'm trying to avoid bad habits as this is my first step
> > > after reading the book.
>
> > We've done a few apps that use email for auth.  In some cases, we generate
> > a random 30-character username, the odds of a collision are very low and we
> > don't run into issues trying to truncate an email address so it will conform
> > to the username field character and length requirements.  In other cases,
> > where we need a deterministic username, we base64 encode a UUID for the
> > username.
>
> > We try to not tie the username to a derivative of the email address, so we
> > can avoid username collisions if the user changes their email address.
>
> > Don't forget to add an index to the email field.
>
> > --
> > Eric Chamberlain, Founder
> > RF.com -http://RF.com/
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx

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



Unistall an App

2010-08-27 Thread nobosh
I ran python setup.py install to install an emailauth app as Im
working to create an auth that is email/password based.

http://github.com/redvasily/django-emailauth

I'm still working to get it installed and working, and would like to
uninstall the module because when I create a project and go to create
an app emailauth I get the following error:

"Error: 'emailauth' conflicts with the name of an existing Python
module and cannot be used as an app name. Please try another name."

I'd like to uninstall emailauth so I can copy the directory into my
project folder and hopefully find a way to use it as an app.

Does that sound right? How do you uninstall an app?

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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unistall an App

2010-08-27 Thread elijah rutschman
On Fri, Aug 27, 2010 at 3:31 PM, nobosh  wrote:
> I ran python setup.py install to install an emailauth app as Im
> working to create an auth that is email/password based.
>
> http://github.com/redvasily/django-emailauth
>
> I'm still working to get it installed and working, and would like to
> uninstall the module because when I create a project and go to create
> an app emailauth I get the following error:
>
> "Error: 'emailauth' conflicts with the name of an existing Python
> module and cannot be used as an app name. Please try another name."
>
> I'd like to uninstall emailauth so I can copy the directory into my
> project folder and hopefully find a way to use it as an app.
>
> Does that sound right? How do you uninstall an app?

What I usually do to remove a Python module is something like:
>>> import emailauth
>>> print emailauth.__file__

That will give me the path to that package or module, and I just
delete the corresponding file or folder.

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



Re: mod_python, apache and django

2010-08-27 Thread Steve Holden
On 8/27/2010 3:21 PM, Jesse wrote:
> I'm loading django onto Windows XP professional with Apache.
> Unfortunately, I need mod_python which only works with python 2.3.
> Django needs python 2.4 and above.  Is there a way around this?
> Thx
> 
Stop needing mod_python? It's obsolete now.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



Re: Services Trade: Legal Work for help switching Django site to App Engine

2010-08-27 Thread Javier Guerra Giraldez
On Fri, Aug 27, 2010 at 1:47 PM, Trendero.com
 wrote:
> I have a site, trendero.com, built using Django and hosted with
> RackSpace on its own server. To reduce costs, I'd like to switch the
> hosting to App Engine, but I'm not a technical guy (had the site built
> using contractors).

just one advice, GoogleAppEngine isn't totally compatible with Django.
 it can run, but needs some reprogramming.  exactly how much depends
on the complexity of your site and (most of all) the personal
programming style used by your developer.

much easier, and you might still save some money, is to migrate to a
cheaper VPS.  rackspace are good, but expensive.  migrating to another
VPS might take just a couple of days (at most!) for any sysadmin.
while reprogramming the app for GAE could take a significant time.

-- 
Javier

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



Auto-generating menus based on walking urls.py?

2010-08-27 Thread Tim Chase
Just playing around with some ideas, I've been trying to figure 
out how to auto-generate some menus based on my url.py config layout.


1) what's the preferred way to get the "base" (rather than 
include()'ed) urls.py  I see a core.urlresolvers.get_urlconf but 
that seems an internal piece of machinery with hacks based on an 
internal cache against something thread-local.


2) is there a way to affix a url-name to a url() that merely does 
an include() or is that a bad idea?  (it would more likely be 
special treatment of an include()'s with a regexp of r'^/' which 
I suppose I could look for instead)


Thanks,

-tkc



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



Re: mod_python, apache and django

2010-08-27 Thread Jesse
Do I not need it to run Apache on Windows with Django?  Or what is the
alternative?  This is the 5th server I've set up and I've always used
mod_python until now.  How do I get past this mod_python step?
Jesse

On Aug 27, 2:16 pm, Steve Holden  wrote:
> On 8/27/2010 3:21 PM, Jesse wrote:> I'm loading django onto Windows XP 
> professional with Apache.
> > Unfortunately, I need mod_python which only works with python 2.3.
> > Django needs python 2.4 and above.  Is there a way around this?
> > Thx
>
> Stop needing mod_python? It's obsolete now.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

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



What replaced mod_python

2010-08-27 Thread Jesse
I'm trying to load django/python 27/apache onto Windows XP.  I'm
following the instructions that recommends mod_python.  Mod_python is
no longer available.  What is it's replacement?  Will apache work
without it?
Jesse

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



Re: What replaced mod_python

2010-08-27 Thread Kenneth Gonsalves
On Fri, 2010-08-27 at 16:35 -0700, Jesse wrote:
> I'm trying to load django/python 27/apache onto Windows XP.  I'm
> following the instructions that recommends mod_python.  Mod_python is
> no longer available.  What is it's replacement?  Will apache work
> without it? 

mod_wsgi has practically replaced mod_python. The mod_python project is
dead and apache has withdrawn support for it. For legacy reasons django
still supports mod_python, but it is no longer the preferred platform.
You could also look at things like nginx with fcgi.
-- 
regards
Kenneth Gonsalves

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



Re: What replaced mod_python

2010-08-27 Thread Reinout van Rees

On 08/28/2010 01:35 AM, Jesse wrote:

I'm trying to load django/python 27/apache onto Windows XP.  I'm
following the instructions that recommends mod_python.  Mod_python is
no longer available.  What is it's replacement?  Will apache work
without it?


mod_wsgi.

(wsgi = web service gateway interface, normally pronounced "wiskey"...)

(I'm having to install django on windows for the first time these weeks. 
Asked a question about it.  mod_wsgi + apache will work, but I got the 
tip of running it under IIS instead: there's a wsgi module for IIS, too. 
 I still have to follow up on that tip: that'll be on monday.).



Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

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



Django, syncbd just stopped working, can't figure out why

2010-08-27 Thread Rick
I just had my syncdb in django stop working, where it won't update any
changes I make to any of my models. When I run it in the terminal it
doesn't give any output just instantly returns a new terminal input
line (meaning it ran through the script but didn't do anything I guess
would be the way to put it).. I have checked and everything is what it
should be as far as I can tell, my apps are included in my
settings.py, etc..

I have been looking at what info I can find for this but so far
nothing is leading me in the right direction, any advice is greatly
appreciated

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



Re: Django, syncbd just stopped working, can't figure out why

2010-08-27 Thread Steve Holden
On 8/27/2010 8:37 PM, Rick wrote:
> I just had my syncdb in django stop working, where it won't update any
> changes I make to any of my models. When I run it in the terminal it
> doesn't give any output just instantly returns a new terminal input
> line (meaning it ran through the script but didn't do anything I guess
> would be the way to put it).. I have checked and everything is what it
> should be as far as I can tell, my apps are included in my
> settings.py, etc..
> 
> I have been looking at what info I can find for this but so far
> nothing is leading me in the right direction, any advice is greatly
> appreciated
> 
Syncdb never changes existing model tables. You will need to delete the
tables that already exist if you want syncdb to re-create them. This can
cause problems if you already have data in the tables. In that case you
might want to look at the South migration tool.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



Any database retrieve query that i do returns nothing, what may I be doing wrong?

2010-08-27 Thread Rick
I have been able to get my database queries to work properly for
deleting existing entries and also adding new entries to the database
but I am completely stumped as to why I am unable to retrieve anything
from my database. I am trying a query such as:

from web1.polls.models import Poll
retquery = Poll.objects.all()
print retquery
--prints: "[ ]"

Also, if I try this, it just returns "poll object"
from web1.polls.models import Poll
retquery = Poll.objects.all()[0]
print retquery
--prints: "poll object"

I have looked at everything and there are definitely entries in the
database, I have tried this with a number of different models where
everything else is working otherwise so I don't know what I can do at
this point, any advice is greatly appreciated

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



Re: Django, syncbd just stopped working, can't figure out why

2010-08-27 Thread Rick
thanks, yeah I realized that after posting which is why I deleted the
question, I should've researched a bit more before posting

On Aug 27, 5:45 pm, Steve Holden  wrote:
> On 8/27/2010 8:37 PM, Rick wrote:> I just had my syncdb in django stop 
> working, where it won't update any
> > changes I make to any of my models. When I run it in the terminal it
> > doesn't give any output just instantly returns a new terminal input
> > line (meaning it ran through the script but didn't do anything I guess
> > would be the way to put it).. I have checked and everything is what it
> > should be as far as I can tell, my apps are included in my
> > settings.py, etc..
>
> > I have been looking at what info I can find for this but so far
> > nothing is leading me in the right direction, any advice is greatly
> > appreciated
>
> Syncdb never changes existing model tables. You will need to delete the
> tables that already exist if you want syncdb to re-create them. This can
> cause problems if you already have data in the tables. In that case you
> might want to look at the South migration tool.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

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



filter by extra() fields

2010-08-27 Thread rok
Hi,

does anyone know a way of filtering a QuerySet by a field that was
added through the extra() method?

For example, this is what I would like to do

_list_items = ListItem.objects.filter(list=1).extra(select='SELECT
value AS "type" FROM list_item_optional WHERE
list_item_optional.list_optional_id=1 AND
list_item_optional.list_item_id = list_item.id')
_list_items = _list_items.filter(type='A')

I know the above situation is not allowed, but what would be the
workaround in Django?

Cheers

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



Re: mod_python, apache and django

2010-08-27 Thread Russell Keith-Magee
On Sat, Aug 28, 2010 at 7:27 AM, Jesse  wrote:
> Do I not need it to run Apache on Windows with Django?  Or what is the
> alternative?  This is the 5th server I've set up and I've always used
> mod_python until now.  How do I get past this mod_python step?

Seriously - the answer is to stop using mod_python. The Apache project
has officially deprecated mod_python [1]. The last release was in
2008, and by deprecating the project, Apache has signalled that there
aren't going to be any releases or updates in the future. Django will
begin the deprecation process for the mod_python backend in the 1.3
cycle [2], so when Django 1.5 comes out, there won't be any support
for mod_python.

At this point in time, if you're investing time and effort setting up
mod_python servers, you're wasting time and effort. You have about
18-24 months to move away from mod_python before your Django projects
stop working.

WSGI is very much the way forward; mod_wsgi is available for Apache,
and a number of other web servers; several of these web servers
(including Apache) are available on Windows. There are also FastCGI
deployment options available. I can't comment on the best option for
Windows deployment, though.

[1] http://attic.apache.org/projects/quetzalcoatl.html
[2] http://code.djangoproject.com/ticket/13820

Yours,
Russ Magee %-)

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



hosting django applications

2010-08-27 Thread Rodrigo Lombardo
Hi!

I'm planning to deploy my first django application and I think it will
have more reads than writes and at least 1 requests a day. So I
will take care about the system cache. I think FreeBSD(my prefered OS)
would do the job, but I heard good things about Amazon EC2 and I would
like to know if anyone here is happy with the Amazon's service.

* The FreeBSD in this case will be a vps with 512mb of ram from rootbsd.net


Thanks,

Rodrigo Nicola
Twitter: http://www.twitter.com/rodnic

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



mod_wsgi setup issue

2010-08-27 Thread Joel Klabo
All the files are shown here: http://gist.github.com/554724

I don't know what I'm doing wrong but I'm still getting 500

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



mod_wsgi, apache, ubuntu setup question (noob alert)

2010-08-27 Thread Joel Klabo
This is my situation: http://gist.github.com/554724

I am getting 500 internal server error, don't know what's up...

I would appreciate any info, I'm a total apache noob.

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



Re: mod_wsgi, apache, ubuntu setup question (noob alert)

2010-08-27 Thread Joel Klabo
problem solved for the time being, I needed to add quotes around the
'settings'

On Aug 27, 10:08 pm, Joel Klabo  wrote:
> This is my situation:http://gist.github.com/554724
>
> I am getting 500 internal server error, don't know what's up...
>
> I would appreciate any info, I'm a total apache noob.

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



Re: mod_wsgi setup issue

2010-08-27 Thread Kenneth Gonsalves
On Fri, 2010-08-27 at 21:48 -0700, Joel Klabo wrote:
> All the files are shown here: http://gist.github.com/554724
> 
> I don't know what I'm doing wrong but I'm still getting 500 

maybe you could try:

sys.path.append('/srv/www/brooski.net/')


os.environ['PYTHON_EGG_CACHE'] = '/srv/www/brooski.net/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = brooski.settings

-- 
regards
Kenneth Gonsalves

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



Re: mod_wsgi setup issue

2010-08-27 Thread Graham Dumpleton


On Aug 28, 2:48 pm, Joel Klabo  wrote:
> All the files are shown here:http://gist.github.com/554724
>
> I don't know what I'm doing wrong but I'm still getting 500

Go look in the Apache error log for the reason for the error and post
that here.

Better still, go watch the mod_wsgi presentation linked from the wiki
tab on the mod_wsgi site as it goes through the errors you would get
for a 500 error and tells you what to do.

Most likely as pointed out by others, it is because sys.path is not
set correctly, but there can be other reasons as well.

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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.