Re: Database connection closed after each request?

2012-01-14 Thread yati sagade
I haven't used it,  but this might help
http://node.to/wordpress/2010/02/11/database-connection-pool-solution-for-django-mysql/Also,
have you tried using SQLAlchemy?

On Sun, Jan 15, 2012 at 8:06 AM, ydjango  wrote:

> Any updates on MySQL connection pool for django. Has anyone
> implemented it yet and willing to share?
> Graham Dumpleton also raised it in G+ today.
>
> On Nov 20 2011, 5:45 am, Jonathan  wrote:
> > Does anyone know if this progressed anywhere since '09?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Yati Sagade 

(@yati_itay )

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



Selecting an E-commerce Application

2012-01-14 Thread Swaroop Shankar V
Hello All,

I need to integrate an e-commerce application into my project and i was
checking few options and I rounded of to 2 options:
1) Satchless 
2) Plata 

Please note that I don't wish to use a framework, instead i wanted an app
which i can integrate into my existing django project. If anyone have used
these before, please recommend which one I should use. Or is there any
better e-commerce app?

Thanks and Regards

Swaroop Shankar V

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



Re: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-14 Thread Graham Dumpleton


On Jan 15, 9:40 am, Stuart Laughlin  wrote:
> Graham turned up on a thread in another forum where I was asking about how
> to fix a strange error I had been seeing intermittently for months. He
> instructed me on how to put mod-wsgi into daemon mode, among other things,
> and finally solved my problem.
>
> Here's a link to the thread, if you're interested.
>
> http://groups.google.com/group/satchmo-users/browse_thread/thread/6a6...

And the problem was actually due to a likely bug in psycopg2 and not
mod_wsgi.

You would have had the same problems with knowing what the cause was
if you had hit this bug when using uWSGI in one of the ways that it
uses sub interpreters.

So, that the issue could arise isn't unique to mod_wsgi, but an issue
for any system using sub interpreters, which for WSGI hosting means
both mod_wsgi and uWSGI.

Ultimately, if an issue like this had occurred with gunicorn you would
have been equally stuffed. This is because the problem was in a C
extension module and problems in C extension modules like that are
hard to debug and invariably are fixed through thinking about the
problem and looking at source code and not through trying to run pdb
or even gdb on a running process. You are lucky when someone else
knows what the issue is already.

That all said, that mod_wsgi and uWSGI in some modes use sub
interpreters does cause more than it share of problems. This though
pretty well always derives from the fact that people writing C
extension modules take short cuts and don't even contemplate that the
extension module may be used in sub interpreters or even in multiple
sub interpreters at the same time.

There have even been examples where in the Python interpreter itself
they have broken things for sub interpreters. For example, fork() is
broken in Python 2.7.2 in sub interpreters. So, even the core
developers don't always get it quite right and they would generally
know more than most people who write C extension modules.

One of the benefits at least is that mod_wsgi is configurable enough
that one can configure around broken third party software when these
sorts of issues arise, other systems may not provide you as much
flexibility. The config you used was also not a 'perfect config' in
the general sense, but was one that just solved your specific problem.
What configuration is best is going to be specific to a particular
application and the requirements.

Now being part of the Apache eco system, mod_wsgi is a bit ham strung
by the default configs forced on people by PHP and Linux distros. So
the default isn't necessarily a good config for sites. Even so, it
still serves adequately for a lot people because the server generally
isn't the issue anyway. The only big problem is usually memory usage
because Apache/mod_wsgi for a Linux distro is embedded and prefork
MPM, which is bad for fat Python web applications.

As to ease of debugging, if you are debugging your code and need to
run pdb or other IDE debugger, although it can be done under mod_wsgi
with the right knowledge, you are much better off doing it in a proper
development system. Debugging is not the missing thing here. What most
people really need is decent monitoring of their production systems.
What use is the ability to debug code if you have no idea what the
problems are that are occurring in your production system to start
with.

So monitoring is going to be more important going forward. The WSGI
hosting issue is reasonably solved and debugging is something one
could always do.

Think about it. Do you really have any idea what your production
system is doing? How much time is spent in your application vs
database, vs time spent calling out to external web services, memcache
etc etc. Do you know how long the application is even taking to do a
connect to your database for every Django request and how much time
that is as a percentage of overall response time. If you don't know,
how do you expect to be able to improve the performance of your
application. This is why monitoring is going to be key and where
Python web applications have been really lacking in the past.

Graham

> --Stuart
> On Jan 14, 2012 8:50 AM, "Sells, Fred"  wrote:
>
>
>
>
>
>
>
> > You referenced Graham’s “The Perfect Config”.  I’ve been googling without
> > success to find that.  Do you have a link?
>
> > ** **
>
> > *From:* django-users@googlegroups.com [mailto:
> > django-users@googlegroups.com] *On Behalf Of *Stuart Laughlin
> > *Sent:* Friday, January 13, 2012 12:52 PM
> > *To:* django-users@googlegroups.com
> > *Subject:* Re: Web Servers for Django Projects [WAS: Does anyone know any
> > blogs...]
>
> > ** **
>
> > Snip
>
> > After all, in spite of Graham coming through with The Perfect Config, I
> > personally decided to not put myself through that experience again and
> > moved away from apache on subsequent projects. I've been pleased with that
> > decision, and I know many others share my experience.
>
> > 
>
> > --
> > You receiv

Re: Database connection closed after each request?

2012-01-14 Thread ydjango
Any updates on MySQL connection pool for django. Has anyone
implemented it yet and willing to share?
Graham Dumpleton also raised it in G+ today.

On Nov 20 2011, 5:45 am, Jonathan  wrote:
> Does anyone know if this progressed anywhere since '09?

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



One To One relationship with a generic relation?

2012-01-14 Thread Stodge
I've used generic relations and they worked, but in one particular
case I need a one-to-one generic relation. Is this possible?

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



RE: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-14 Thread Stuart Laughlin
Graham turned up on a thread in another forum where I was asking about how
to fix a strange error I had been seeing intermittently for months. He
instructed me on how to put mod-wsgi into daemon mode, among other things,
and finally solved my problem.

Here's a link to the thread, if you're interested.

http://groups.google.com/group/satchmo-users/browse_thread/thread/6a65b4ab28df38dc/a9b22c236d63c323

--Stuart
On Jan 14, 2012 8:50 AM, "Sells, Fred"  wrote:

> You referenced Graham’s “The Perfect Config”.  I’ve been googling without
> success to find that.  Do you have a link?
>
> ** **
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Stuart Laughlin
> *Sent:* Friday, January 13, 2012 12:52 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Web Servers for Django Projects [WAS: Does anyone know any
> blogs...]
>
> ** **
>
> Snip
>
> After all, in spite of Graham coming through with The Perfect Config, I
> personally decided to not put myself through that experience again and
> moved away from apache on subsequent projects. I've been pleased with that
> decision, and I know many others share my experience.
>
>
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+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-users@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: Primary key for read-only models

2012-01-14 Thread JohnA
I think you can do what you want as long as you set your read-only
model to managed=False in the Meta.  You have to set some field to
primary_key=True but it doesn’t have to actually be unique.  To avoid
situations where django will do something that will only work if it is
unique you might want to put the primary_key=True on a field you never
use for lookup.

You’ll have to create and populate the unmanaged table yourself, and
create whatever indices you think will be helpful in doing lookups. (I
assume you were planning that anyway.)  I believe the decision as to
what if any indices to use for a given lookup (i.e. select) is
entirely internal to the db and is not controlled or influenced by
django.  If you always do lookup via unique combinations of fields,
and you create an index on the combination, you’d expect the db to use
that index, but you never know.

I haven’t done this for real but I might have to down the road so I
did a little test.

# model

class NoPrimaryKey(models.Model):
class Meta:
managed=False
db_table='my_noprimarykey_table'
unique_together=('charField','integerField')
charField = models.CharField(max_length=32,primary_key=True)
integerField = models.IntegerField()
dateField = models.DateField(null=True)

def __unicode__(self):
return u'%s %s' % (self.charField,self.integerField)

# test script

from myapp.models import NoPrimaryKey

def main():
for c,i in (('record 3',300),('record 3',301),):
obj = NoPrimaryKey.objects.get(charField=c,integerField=i)
print obj
main()

# contents of db:

sqlite> select * from my_noprimarykey_table;
record 1|100|
record 2|200|
record 3|300|
record 3|301|
sqlite>

# output of test script

record 3 300
record 3 301

Note that I did this with sqlite.  It can’t promise it will work with
mysql or other backend.



On Jan 12, 10:03 am, Demetrio Girardi 
wrote:
> I need to read data from an "external" database table from my django
> project. I am not interested in modifying the data, only reading it.
> Of course I would like to create a django model for the table, because
> it makes life so much more easier.
>
> I have already done this previously, however in this case the table
> has a multiple field primary key, unsupported by Django. There is no
> other field which is guaranteed to be unique that I can use as primary
> key in the Django model.
>
> Do I need to worry about this? or can I just slap the primary_key flag
> on any of the fields, since I will never be inserting or updating in
> that table?

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



Joining tables

2012-01-14 Thread Swaroop Shankar V
hello All,
I have a model of following structure

class ExtraInfomration():

user = models.OneToOneField(User)
total_likes = models.IntegerField(_('Total Likes'), null=True, blank=True,
default=0)
total_dislikes = models.IntegerField(_('Total Dislikes'), null=True,
blank=True, default=0)
popularity = models.FloatField(_('Popularity'), null=True, blank=True,
default=0.0)
created_on = models.DateTimeField(auto_now_add = True, null=True)
updated_on = models.DateTimeField(auto_now=True)

I have another model for profile. I need to retrieve users ordered by the
popularity from the User model. This is the code am using to retrieve the
users list
userObject = User.objects.filter(is_active=1,is_staff=0,is_superuser=0)

how can i order the data based on the popularity field in extrainformation?
Thanks

Regards,

Swaroop Shankar V

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



Searching for django developer with good experience in JQuery/CSS3 and Html

2012-01-14 Thread Mo Mughrabi
Hello,

I've been working with a team for the past 6 months on a project, the
project is designer on cloud computing, using django as our main framework,
rabbitmq and celery to handle transactions. We are currently, consist of
project lead and 3 developers.

We have a very high standard in coding, deployment and communication. We
are searching for an additional developer, who will help in a lot of UI
work, which will involve CSS, JQuery, and has good sense of design he could
be a beginner level in django/python would be enough, but if knows more,
the better :)

Please reply back to me with rate, portfolio and when can you start?


Regards,

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



RE: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-14 Thread kenneth gonsalves
On Sat, 2012-01-14 at 09:49 -0500, Sells, Fred wrote:
> You referenced Graham’s “The Perfect Config”.  I’ve been googling
> without success to find that.  Do you have a link?
> 
> 

he means Graham's config is perfect. Google for django+wsgi
-- 
regards
Kenneth Gonsalves

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



RE: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-14 Thread Sells, Fred
You referenced Graham's "The Perfect Config".  I've been googling
without success to find that.  Do you have a link?

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Stuart Laughlin
Sent: Friday, January 13, 2012 12:52 PM
To: django-users@googlegroups.com
Subject: Re: Web Servers for Django Projects [WAS: Does anyone know any
blogs...]

 

Snip

After all, in spite of Graham coming through with The Perfect Config, I
personally decided to not put myself through that experience again and
moved away from apache on subsequent projects. I've been pleased with
that decision, and I know many others share my experience.




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