Re: Scaling/Parallel patterns for a View executing complex database transaction

2015-05-14 Thread Stephen J. Butler
If it's just key-value storage, adding a memcached layer sounds like a good thing to investigate. Do the tuples frequently change? On Thu, May 14, 2015 at 11:30 PM, Me Sulphur wrote: > Hi Russ, > > Thanks! While there are some pointers that we can pick up from your answer, > let me add some more

Re: Scaling/Parallel patterns for a View executing complex database transaction

2015-05-14 Thread Me Sulphur
Hi Russ, Thanks! While there are some pointers that we can pick up from your answer, let me add some more details. * It is a large key-value pair table (approaching ~ 1 bn rows) with an MD5 key and JSON for value. The look ups depend on the business logic but are necessary. Nevertheless, ther

Re: best way change template base my app

2015-05-14 Thread carlos
Thank Andre Luis :) On Wed, May 13, 2015 at 1:41 PM, André Luiz wrote: > extends should always be on first line of file and it accepts a variable > as argument so you can define which template should be used on your view. > > # views.py > def home(request): > if request.session.type == 1: >

Fwd: What is the ideal web server to use with Django?

2015-05-14 Thread Andrew Farrell
Ashkat, I second the recommendation that Ashkat go with gunicorn+nginx for the same reason Avraham does. Digital Ocean has a good walkthrough of how to set that up here . One t

Re: Scaling/Parallel patterns for a View executing complex database transaction

2015-05-14 Thread Russell Keith-Magee
On Thu, May 14, 2015 at 6:03 PM, Me Sulphur wrote: > Stack: Django 1.7 + Postgres 9.3 + Linux (No caching) > > Our application has a view which is called/executed very frequently. The > view receives, parses and responds a JSON. > > In between request and response, there are about 3-5 inserts and

differences of admin/auth/user between django 1.6.2 and 1.6.5

2015-05-14 Thread josephine
On my localhost where I have django 1.6.2, the admin/auth/user/ page has a search box and filter; when I click a specific user for "Change user", I can change the user's password using admin/auth/user/3/password/; On a different machine that has django 1.6. 5, the admin/auth/user/ page does not

Re: data migrations for large tables on Postgres

2015-05-14 Thread Vernon D. Cole
I was thinking of something like that ... but I am not a good enough plpgsql programmer to figure out how to do the chunking in SQL. I needed a way to do the data calculations a thousand rows at a time, rather than all ninety-million in one gulp. So I have Python do the chunking and SQL do th

Re: data migrations for large tables on Postgres

2015-05-14 Thread john
As a newbie - would it be better to use pgadmin (or psql) to make the changes and migrate --fake so that Django would be happy? Johnf On 05/14/2015 02:43 PM, Vernon D. Cole wrote: I have learned the hard way this week that data migrations in django 1.8, as wonderful has they are, do not scale.

data migrations for large tables on Postgres

2015-05-14 Thread Vernon D. Cole
I have learned the hard way this week that data migrations in django 1.8, as wonderful has they are, do not scale. My test data table is now sitting at about 90,000,000 rows. I was able to add a "null=True" field in an instant, as documented. Then came my attempt to fill it -- I tried using R

Re: How to load an object created from a model outside the project ?

2015-05-14 Thread Matthieu
These solutions seem interesting :) Thanks ! Le jeudi 14 mai 2015 13:44:15 UTC+2, Gergely Polonkai a écrit : > > Hello, > > depends on what exactly you want to do. You can take a look at Django’s > own serialization solution[1], or, if you want to build a REST framework > based on this, you may

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Timothy W. Cook
That is exactly the problem Simon. Everyone of those models reference a model called Project. I did this so that when the items are displayed in the selects, the user knows which project it is from. In the interim I guess I'll remove the call to Project from the __str__ I wonder if there is ano

Possible bug in QuerySet API when chaining filter() and update() methods?

2015-05-14 Thread Alejandro Treviño
Hello everyone, first-time poster here! I ran into an interesting scenario earlier today that I thought was worth sharing: Given this update statement using the django ORM: >>> pks = MyModel.objects.all().values_list('pk', flat=True) >>> pks [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, '...(rema

Re: How do I display a map with GeoDjango models?

2015-05-14 Thread Thomas Levine
Indeed I can! It looks like I'm going to use Polymaps instead, but the magic I was looking for was djgeojson.views.TiledGeoJSONLayerView. I think. It's quite slow, so I might wind up generating them in batch. Maybe that's why there wasn't such an obvious answer On 14 May 06:52, Derek wrote: >

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
The last example should read: if db_field.name == 'baz': Le jeudi 14 mai 2015 11:14:24 UTC-4, Simon Charette a écrit : > > It's a bit hard to tell without your model definition and the executed > queries but is it possible that the string representation method (__str__, > __unicode__) of one

Re: What is the ideal web server to use with Django?

2015-05-14 Thread Marc Aymerich
On Thu, May 14, 2015 at 11:26 AM, Tom Evans wrote: > > On Thu, May 14, 2015 at 4:36 AM, reduxionist > wrote: > > The question you asked Tom was "Doesn't Apache create new process for each > > request [thus eating memory when serving large amounts of static files > > during traffic peaks]?", and

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
I meant if db_field.name == 'bars': Sorry for noise... Le jeudi 14 mai 2015 11:15:49 UTC-4, Simon Charette a écrit : > > The last example should read: > > if db_field.name == 'baz': > > > > Le jeudi 14 mai 2015 11:14:24 UTC-4, Simon Charette a écrit : >> >> It's a bit hard to tell without your m

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
It's a bit hard to tell without your model definition and the executed queries but is it possible that the string representation method (__str__, __unicode__) of one the models referenced by a M2M access another related model during construction? e.g. from django.db import models class Foo(mo

User defined API for Django Rest-Framework

2015-05-14 Thread SUBHABRATA BANERJEE
Dear Group, I am trying to design API on Rest framework on Django. I could make one Browsable API as given in http://www.django-rest-framework.org/tutorial/quickstart/. I am looking to change the views, to user defined views. If anyone may kindly suggest how may I do it? I am pretty new in

Re: What is the ideal web server to use with Django?

2015-05-14 Thread Jonathan Barratt
> On 14 พ.ค. 2558, at 05:26, Tom Evans wrote: > >> On Thu, May 14, 2015 at 4:36 AM, reduxionist >> wrote: >> The reason for those search results is that mpm-prefork does, however, spawn >> a process per request, > > No, really, it does not. It only spawns a new process when there are > no ava

Re: How do I display a map with GeoDjango models?

2015-05-14 Thread Derek
Could you not add them as multiple Leaflet layers; each layer pointing to a view for the model in question. There is a simple overview here: http://www.slideshare.net/makinacorpus/team-up-django-and-web-mapping-djangocon-europe-2014 There is much more detail on the django-leaflet site (e.g. ht

Re: Django 1.8 tutorial-Chapter4: ValueError at /polls/1/vote/

2015-05-14 Thread Charito Romeo
Hi Alasdair, Thanks a lot for the help. It's working now. Cheers :) Charito On Thu, May 14, 2015 at 7:57 PM, Alasdair Nicol wrote: > On 14/05/15 02:50, charito.romeo wrote: > >> | >> > value="{{ >> choice.id }}"/> >> | >> > > The problem is that there is a new line in the middle of >

Re: django-allauth without username, login with facebook doesn't work

2015-05-14 Thread Fellipe Henrique
Hello Mario, thanks for help me... Yesterday I found the problem, here is: First i used python-social-auth after I move to django-allauth... for some reason, when I uninstalled the python-social-auth, the folder still in site-package, and when I call my template, django use the python-social-a

Re: Django 1.8 tutorial-Chapter4: ValueError at /polls/1/vote/

2015-05-14 Thread Alasdair Nicol
On 14/05/15 02:50, charito.romeo wrote: | | The problem is that there is a new line in the middle of "{{ choice.id }}". Change it to: value="{{ choice.id }}"/> Cheers, Alasdair -- Alasdair Nicol Developer, MEMSET mail: alasd...@memset.com web: http://www.memset.com/ Memset Lt

Re: form_invalid and missing ob

2015-05-14 Thread David
Fixed. Was missing: self.form = self.get_form(self.form_class) self.object_list = self.get_queryset() from def form_invalid(self, form): -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails f

Re: How to load an object created from a model outside the project ?

2015-05-14 Thread Gergely Polonkai
Hello, depends on what exactly you want to do. You can take a look at Django’s own serialization solution[1], or, if you want to build a REST framework based on this, you may want to look at [2] or [3]. Best, Gergely [1] https://docs.djangoproject.com/en/1.8/topics/serialization/ [2] https://dja

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Timothy W. Cook
It isn't that the individual queries are very slow. But that there are so many of them. Attached is a screenshot of DjDT. I see that I am not using a cache at all. This was after doing a reload of the same standard Django admin/change_form.html. On Wed, May 13, 2015 at 1:58 PM, Tim Graham wrote

Re: coffin.shortcuts error

2015-05-14 Thread Stephen J. Butler
The developer of coffin released v2.0 which is pretty much a simple stub. He recommends you switch to django-jinja. You probably want to limit your requirements.txt to coffin<2.0. On Thu, May 14, 2015 at 1:28 AM, wrote: > Hi, first of all i'm sorry for my bad english. > > > I am installing a dj

Django 1.8 tutorial-Chapter4: ValueError at /polls/1/vote/

2015-05-14 Thread charito.romeo
I am following the django 1.8 tutorial and I currently finished Part 4. My problem is when I tried to click on one of the radio buttons to vote, it gave me a ValueError below: ValueError at /polls/1/vote/ invalid literal for int() with base 10: '{{ choice.id }}' Request Method:POSTRequest

coffin.shortcuts error

2015-05-14 Thread eneasgallego
Hi, first of all i'm sorry for my bad english. I am installing a django app for continuing its develop, but when I try to start the app I get this error: ImportError at / No module named shortcuts Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.5 Exception Type

choice field with a twist?

2015-05-14 Thread MikeKJ
I may have to radically rethink this from model up but there may be a solution? I have a model called ZoneCost which contains the data A : 0.8 B: 0.9 C: 1.0 D: 1.2 E: 1.4 and another model Card that among other things contains a zone identifier What I want to do is in a view 1. Get the zone a

Re: form_invalid and missing ob

2015-05-14 Thread David
Doh, fixed. Fix below for anyone else with the same problem: def post(self, request, *args, **kwargs): form = self.get_form() if form.is_valid(): return self.form_valid(form) else: return self.form_invalid(form, *args, **kwargs) def form_invalid(self, form, *args, **kwargs): messages.error(self.

form_invalid and missing ob

2015-05-14 Thread David
Hi When I submit my form with no errors it correctly processes and returns after completing form_valid. However, when I submit my form with errors I get a django dump stating that 'ShowForumPostsView' object has no attribute 'object_list'. I am struggling to make it return to the same page bu

Re: How to load an object created from a model outside the project ?

2015-05-14 Thread Matthieu
Hi Gergely, Thanks for you answer. I don't need to modify the object. I also tried with "dill" package but it's not working either. How can I use serialization with my example ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe f

Scaling/Parallel patterns for a View executing complex database transaction

2015-05-14 Thread Me Sulphur
Stack: Django 1.7 + Postgres 9.3 + Linux (No caching) Our application has a view which is called/executed very frequently. The view receives, parses and responds a JSON. In between request and response, there are about 3-5 inserts and around 1200-5000 look ups depending upon some if..else busines

Re: What is the ideal web server to use with Django?

2015-05-14 Thread Avraham Serour
My main reason for recommending nginx is the config file, they are simpler than apache, when developing an application you shouldn't spend much time configuring the web server, only after you reached so much traffic that it would make sense to spend time with it On May 14, 2015 12:26 PM, "Tom Evans

Re: What is the ideal web server to use with Django?

2015-05-14 Thread Tom Evans
On Thu, May 14, 2015 at 4:36 AM, reduxionist wrote: > The question you asked Tom was "Doesn't Apache create new process for each > request [thus eating memory when serving large amounts of static files > during traffic peaks]?", and the reason that Tom correctly answers "No" is > that as far as "s