Re: Using the Django ORM in a long-running worker process

2016-08-19 Thread Mike Dewhirst
We saw a presentation last weekend at pyconau by Andrew Godwin about Django Channels and you might like to check the YouTube video. It lets long-running processes keep web sockets open in parallel with http requests. Connected by Motorola Daniel Tao wrote: >Thank you for the thorough response

Re: Using the Django ORM in a long-running worker process

2016-08-19 Thread Daniel Tao
Thank you for the thorough response, which has proven very helpful, mainly by reinforcing what I was growing to suspect: we've updated the code in our worker processes to close the DB connection after every message, and sure enough we've seen a huge improvement in the form of significantly fewer

Re: receiving PNG file in django

2016-08-19 Thread Aron Griffis
Hi Larry, I think you'll find what you're looking for in request.FILES, see https://docs.djangoproject.com/en/1.10/ref/request-response/#django.http.HttpRequest.FILES and https://docs.djangoproject.com/en/1.10/ref/files/uploads/#uploaded-files This is the same as using cgi.FieldStorage to parse f

Re: Django query not returning all objects

2016-08-19 Thread Constantine Covtushenko
Hi Koonal, Sorry for not exact suggestion. I hope that combination of `annotate` and `values` will be helpful, see this link for more detailed explanation . Pleas try something like following: cases = HeartFlowCase.objects.v

Re: Starting new project -- version 1.10

2016-08-19 Thread Rich Shepard
On Fri, 19 Aug 2016, Tim Graham wrote: Don't use the same name for your app and project. When you "startproject crm", the project settings.py, urls.py, and wsgi.py are placed in a module named "crm" so you can't use the same name for an app. Tim, I read that but overlooked the implications.

Re: Starting new project -- version 1.10

2016-08-19 Thread Tim Graham
Don't use the same name for your app and project. When you "startproject crm", the project settings.py, urls.py, and wsgi.py are placed in a module named "crm" so you can't use the same name for an app. On Friday, August 19, 2016 at 2:54:56 PM UTC-4, Rich Shepard wrote: > > I'm working my way

[Feedback requested] Django Debug Toolbar: Removal of automatic setup

2016-08-19 Thread Matthias Kestenholz
Hi everyone, I wanted to solicit some feedback on the removal of automatic setup before moving forward with it. There's a pull request[1] by Jon Dufresne which removes the feature, and if anyone feels strongly about it now would be the time to speak up. The documentation encourages users to use

Learning django and python from Tutorials,

2016-08-19 Thread K.R. O'Connell
I made the App called polls, Nifty! Now I need to edit the homepage of the site? I can't figure which template to edit? Any help would be appreciated Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and sto

receiving PNG file in django

2016-08-19 Thread Larry Martell
I have a falcon server that I am trying to port to django. One of the falcon endpoints processes a request that contains a PNG file sent with content_type = 'application/octet-stream'. It writes the data to a file maintaining the correct PNG structure. The falcon code does this: form = cgi.FieldS

Starting new project -- version 1.10

2016-08-19 Thread Rich Shepard
I'm working my way through the tutorial and creating the application I want rather than the articles example. I've become stuck between two sections of the tutorial. Creating the project (section 2.3.1 worked fine from the TLD, ~/development/: django-admin startproject crm created ~/develop

Re: Unable to get tests to work

2016-08-19 Thread Matt
I purged all the '*.pyc' and the result remains the same. The missing pyc files could be explained by that I use Pycharm to dev in. It appears that this IDE cleans those up automatically. Also I have been dropping to a shell trying to test things to resolve the issue, which would explain why th

Re: Unable to get tests to work

2016-08-19 Thread Fred Stluka
Matt, At a glance, the directory structure looks OK.  Seems odd though that you have some *.pyc files with no corresponding *.py file. For example, frontend/tests.pyc and nas/tests.pyc.  Could such a file be tripping up the test runner?  That might explain why it

Re: Django query not returning all objects

2016-08-19 Thread Simon Charette
For reference there's a Django ticket to suggest using this technique. Cheers, Simon [1] https://code.djangoproject.com/ticket/19842 Le jeudi 18 août 2016 02:20:34 UTC-4, Todor Velichkov a écrit : > > Another solution would be to annotate min/max deadline date and order by > the annotation. Som

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
Michal, thanks for following up. I'll try your suggested code from your other response upthread and see if it solves the problem as well as the form.__init__. And do more digging about how Python does things. I am a self-taught programmer who focuses on community economic development and I usua

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
On Fri, Aug 19, 2016 at 02:38:02PM +0200, Michal Petrucha wrote: > On Fri, Aug 19, 2016 at 05:02:39AM -0700, bobhaugen wrote: > > On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: > > These questions remain unanswered, although I intend to do a bunch more > > testing: > > > >

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
On Friday, August 19, 2016 at 7:38:45 AM UTC-5, Michal Petrucha wrote: > > Honestly, I'm not sure what exactly you're asking here. Your > implementation of ``with_user`` was hard-wiring a queryset filter > based on the state of the database at the time ``with_user`` was > called. The rest is jus

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
On Fri, Aug 19, 2016 at 05:02:39AM -0700, bobhaugen wrote: > On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: > > > > Could you show us the code of with_user? Maybe it does not return an > > unevaluated queryset? > > > > > def with_user(self): > all_agents = Ec

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread ludovic coues
You were calling the method in the class definition. The class is "defined" when the module is imported. That's why things where "cached". Module is imported only once. The init method on the other hand is called every time an instance of the class is created. I believe that method will be called i

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: > > Could you show us the code of with_user? Maybe it does not return an > unevaluated queryset? > > def with_user(self): all_agents = EconomicAgent.objects.all() ua_ids = [] for agent in all_agen

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
On Thu, Aug 18, 2016 at 11:57:40AM -0700, bobhaugen wrote: > On Thursday, August 18, 2016 at 1:34:29 PM UTC-5, Tim Graham wrote: > > > > I'd guess you're doing a query for the form field's choices at the module > > level which will be executed once and cached for as long as the server > > runs. S