Re: DatabaseError: execute used with asynchronous query
As far as I remember, I quickly switched back to 'sync' worker type (the default) for the app which had this problem. I've never seen the error again. I have another project running on eventlet, still with gunicorn, postgres, and psycopg2. Never have had any problems with that one. So maybe it is a problem with gevent. I'd like to hear from someone who has had success with gevent. On Tuesday, February 28, 2012 7:34:03 AM UTC-6, Daniel Svonava wrote: > > Hi, this same error happened to me as well. My setup: > > Django==1.3.1 > gevent==0.13.6 > greenlet==0.3.4 > gunicorn==0.13.4 > psycopg2==2.4.4 > > I use this function to make psycopg2 "green" (in the gunicorn config): > > worker_class = "gevent" > def def_post_fork(server, worker): > from psyco_gevent import make_psycopg_green > make_psycopg_green() > worker.log.info("Made Psycopg Green") > post_fork = def_post_fork > > > This is making me worried of using the Gunicorn+Gevent+psycopg2 combo. > > Cheers, > Daniel > > On Friday, January 20, 2012 3:46:47 PM UTC+1, j_syk wrote: >> >> I was testing one my apps today with a form that features a drop-down >> field that initiates a json lookup for additional detail. You choose a >> location, it populates address fields. It's been working for weeks. >> Today, when I clicked an entry, the target detail field didn't change. >> >> I have debug off, so instantly I feel my phone buzz and I've been sent >> a http500 report e-mail with the following message- >> >> >> DatabaseError: execute cannot be used while an asynchronous query is >> underway >> >> >> I can't seem to reproduce the error, it's never happened before, and I >> haven't changed this piece of code for a while, so I doubt it's >> something new. >> >> I'm willing to write it off as a fluke, but at the same time I'd like >> to learn more and the search results on the topic don't seem good. >> >> Server setup is Django 1.3.1, Gunicorn 0.13 with geventlet processes, >> Nginx 0.7, postgres 8.4.8, >> That particular page was using Jquery and a .getJSON call to a json >> output produced by a django view which calls a basic query. >> >> What should I know about the "asynchronous query" error? Are there >> ways to prevent it? Should I be worried? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/yrBK5DVnN30J. 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: where do you host your django app and how to you deploy it?!
I have a Linode VPS. Best decision I've made. I had tried A Small Orange and Webfaction, was happy with the customer/tech service from both (ASO isn't really setup for easy Django setup), but eventually you may run into situations were you wish you had full access to the server. I use Nginx & Gunicorn. It's a really easy setup to get started with and it's good. On Monday, April 2, 2012 5:48:24 AM UTC-5, fix3d wrote: > > Where do you host your django app and how to you deploy it?! > > Please share personal exp. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HQhgwNVPGcIJ. 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: ManyToManyField is this right?
One to One is the right type for linking a user to a profile in the Django world. However I think you may be mixed up on the many to many. How you have it setup would lead to a User being connected to multiple License objects, each with a nra and ccl attribute. If I didn't realize what those stood for, I'd say you are right. But, I think that you might be thinking of it as the nra and ccl being separate licenses so in that case they shouldnt be the same object Here's what I'd recommend. Either put those two booleans directly on the profile model or make the License class more generic for any relevant details of a potential license. For example class License(models.Model): name = models.CharField(max_length=255) expiration = models.DateField(blank=True, null=True) details = models.TextField() With something like this, the User could have multiple licenses like: Concealed Carry 5/10/2015 and NRA no expire . On Wednesday, June 27, 2012 8:57:24 AM UTC-5, David Wagner wrote: > > I'm a self taught programmer who hasn't done much of anything for years so > please forgive me if this question is naive. I have a hard time sometimes > understanding some of the lingo used by trained programmers. > > With that said, I'm having trouble wrapping my brain around the ManyToMany > and Many-To-One and OneToOne concepts. I'm trying to create a multi-select > option for a user profile in which a user can have multiple attributes of a > certain kind. Right now I'm just working on the model. This is what I have, > is it right? > > # Different licenses for instructors to select from > class Licenses(models.Model): > nra = models.BooleanField() > ccl = models.BooleanField() > > # User Profile Model > class UserProfile(models.Model): > user = models.OneToOneField(User) > > #... > > licensed_instructor = models.ManyToManyField(Licenses) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/VModQy3bu7UJ. 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: map in django
This Gist https://gist.github.com/1027898 is an example of a location Model which calls on a helper function when saved to find the lat & long of the address when it is saved. The original snippet of the function is here- http://djangosnippets.org/snippets/2399/ On Wednesday, July 11, 2012 2:35:24 AM UTC-5, Satvir Kaur wrote: > > On Wed, Jul 4, 2012 at 9:23 PM, yak-man wrote: > > You might try browsing these: > > The code from Zain's US PyCon2012 tutorial on making interaxtive maps is > also in his github repositories - you might find that interesting. > What is link for that??? > > > -- > Satvir Kaur > satveerkaur.blogspot.in > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/6Xfx3oUgXvQJ. 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.
postgres- can nulls be first when sorting in asc order?
Hello- On Friday afternoon I migrated a project from sqlite to postgres. Everything went smoothly and I was able to go home for the weekend and be happy. Yay. This morning I was informed that the sort order is different. I have a DateField for a due date that is set as not required, however leaving it blank treats it as ASAP. I'm assuming this is a result of the different sort orders between sqlite and postgres. I got used to sqlite sorting it like: "None, Oct, Dec, etc." but now I am getting "Oct, Dec, etc., None". Here are the options I'd rather not do: -Go back to sqlite -set the default as some date years ago and override the display value in templates (I already use this method to make a None show as "ASAP") i.e. {% if item.due_date == '1999-1-1' %}ASAP{% else %} {{ item.due_date }}{% endif %} -add another field to the model, a boolean field for ASAP, set it to true if the due date is blank and sort by that first (this may actually be a decent option) I'm hoping there is a setting in postgres that can be changed for the sort priority of null. Is this any easy way to solve this problem before I start reworking all the code? -- 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: postgres- can nulls be first when sorting in asc order?
Found a similar post http://groups.google.com/group/django-users/browse_thread/thread/4edf7a4a94c65c17/2dfbc193845d4383?lnk=gst&q=sort+null#2dfbc193845d4383 The main difference is that mine is a DateField. So I can't just make it 0 instead of None. -- 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: postgres- can nulls be first when sorting in asc order?
> You can control the order of how nulls sort with pgsql (at least, 8.3 > and above) by appending 'NULLS FIRST' or 'NULLS LAST' to the 'ORDER > BY' clause of a select query. Good to know. I am using 8.4, I may look into adding the order by into a .extra() call. Thanks Due to the urgency, I went with option 3 on my list (adding an ASAP field to the model), It just frustrates me that I now have a column that is false except when the due_date column is null. Just seems like such a waste, I wish I could have hooked into the due_date. Good news is that this guarantees the right sort for any db, should I ever need to switch it. -- 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.
looking for an event planning app
I'm looking to build a site to plan events for a small convention. I've been looking around for an Here's what I'm looking for: -Users can sign up to host an event at a given location -User can pick event length in hour or 30min increments -There can't be more than one event at the same location and time -Chart/spreadsheet view of the whole event, or a specific location It would be like a meeting space planning application. I'm kinda on a time crunch so finding an existing app would be nice, if not, this won't be too hard to implement myself (and may have to post a repo if it's any good). Anyone know of any suitable apps to check out? 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-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.
foreign key select widget with "add" link
I have a Model with a ForeignKey and I'm using a vanilla ModelForm, so it's using the standard ModelChoiceField widget. I'm looking to add a '+' icon with a link to popup and new window to add a new foreign key that is not already in the dropdown list. Yes, exactly like the admin forms. I've done it in the past by manually laying out the form in the template (still with {{ field }} and {{ label }} values, just no looping at all). I don't want to do this again. I could append the link via javascript. But that's dirty. I quickly took a stab at extending the ModelChoiceField, but I failed and moved on. Searching the web for a solution hasn't been good to me. What's the easiest way to cleanly add this to a form and get it to refresh the choices? -- 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: Need "edit" and "delete" buttons on each line of a rendered table
This a good application for named urls with passing arguments. for example, given a urls.py containing url(r'^edit/(?P[0-9]+)/$', edit_item, name="edit_item"), in your template you can do this: {% for item in item_query %} Edit {% endfor %} Hope that helps! Named urls are the preferred DRY method too and so easy to use! On Jan 16, 8:04 am, Bill Beal wrote: > Thanks, I'll try that. > > On Mon, Jan 16, 2012 at 8:58 AM, Szabo, Patrick (LNG-VIE) < > > > > > > > > patrick.sz...@lexisnexis.at> wrote: > > Hi, > > > I'm doing the exact same thing. What i do is i add the id of the object of > > a row to the url that the button is linking to. > > Then I use urls.py and views.py to identify that id and delete or add the > > object. > > > cheers > > > . . . . . . . . . . . . . . . . . . . . . . . . . . > > Ing. Patrick Szabo > > XSLT Developer > > LexisNexis > > A-1030 Wien, Marxergasse 25 > > > mailto:patrick.sz...@lexisnexis.at > > Tel.: 00431 534521573 > > Fax: +43 1 534 52 146 > > > -Ursprüngliche Nachricht- > > > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] > > Im Auftrag von Bill Beal > > Gesendet: Montag, 16. Jänner 2012 14:55 > > An: Django users > > Betreff: Need "edit" and "delete" buttons on each line of a rendered table > > > Hi All, > > > I'm trying to render a table and have an EDIT > > button and a DELETE button on each line, like: > > > ID number ID type EDIT DELETE > > > and identify which line is to be EDITed > > or DELETEd. I tried to create a unique name > > for each button, like: > > > > value="EDIT" /> > > > but the template language won't let me add. > > Is there a simpler way to know which line > > the submit came from, that works? > > Or even a complicated way that works? > > > Bill Beal > > > -- > > 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. -- 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: mac vs windows installation /deployment
This isn't really an answer to your question, but here's my 2 cents. I'm in the reverse situation as you, Macs at work and Windows at home. I wasn't too interested in figuring out Django development on either after quickly disliking macports and never having the desire to develop on windows without a specific IDE. Although at the time I tried both, I was probably just too overwhelmed with everything I need to try to learn. I have always used a linux environment (ubuntu), mostly though ssh on headless clients. For a while I was running ubuntu desktop and server editions though virtual machines on both my work mac and windows computer at home and using osx and windows as my workspace. But now I have dedicated Linux servers at work and home to develop on, and a linode slice for public websites. I guess I've gotten used to a terminal based approach and using FTP as necessary. I don't know what your plans are in the future, but a lot of web hosting servers are Linux, so it may be beneficial to have experience and/or be able to directly port over projects. I know you asked for A or B and I said C, but maybe think about it. -- 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: mac vs windows installation /deployment
On Jan 16, 10:31 am, Javier Guerra Giraldez wrote: > it's a pity that MacOS is going the same route (i think 10.4 still > included XCode in the optional installers DVD), so there's some demand > for binary distribution for Mac too. mac osx 10.7 (Lion) includes Xcode for free from the app store. AFAIK this is the first time it's been available free for a while (I guess 10.4 as you say). So Python_Junkie, it may be cheaper to upgrade to 10.7 than to buy xcode for your current version. last i heard xcode was kinda expensive and i think the Lion upgrade is just $30. Unless maybe now they rolled back the price of xcode for all osx versions. -- 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.
DatabaseError: execute used with asynchronous query
I was testing one my apps today with a form that features a drop-down field that initiates a json lookup for additional detail. You choose a location, it populates address fields. It's been working for weeks. Today, when I clicked an entry, the target detail field didn't change. I have debug off, so instantly I feel my phone buzz and I've been sent a http500 report e-mail with the following message- DatabaseError: execute cannot be used while an asynchronous query is underway I can't seem to reproduce the error, it's never happened before, and I haven't changed this piece of code for a while, so I doubt it's something new. I'm willing to write it off as a fluke, but at the same time I'd like to learn more and the search results on the topic don't seem good. Server setup is Django 1.3.1, Gunicorn 0.13 with geventlet processes, Nginx 0.7, postgres 8.4.8, That particular page was using Jquery and a .getJSON call to a json output produced by a django view which calls a basic query. What should I know about the "asynchronous query" error? Are there ways to prevent it? Should I be worried? -- 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: pip search raises "time out"
I just tried it and it returned about 3500 results. Did you really want that many results? running "pip search --help" shows that you can set a --timeout flag, and the default is 15 seconds try: pip search --timeout=30 Django On Wednesday, January 9, 2013 8:34:41 AM UTC-6, Matias Montenegro wrote: > > I need a hand with this problem. I get a "time out" exception when i run > "pip search", but "pip install" works fine. I'm using a proxy and I can't > deactivate it. Does anybody know why it might be happening? > > http://pastebin.com/2z7SPqf2 > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WqZPwBreU4UJ. 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: I screwed up my django site using touch
It's not a problem with wsgi. The problem is incorrect syntax in line 29 of your views.py file. Check that line and make sure that each line is at the same indentation or is properly indented (4 spaces). If you can't figure this out, post a couple lines from that area of your views.py file and we can help with the syntax and formatting. On Thursday, March 7, 2013 8:06:04 AM UTC-6, frocco wrote: > > I do not understand what the error indentation means. > I am new to django, coming from PHP. > I was using touch, because unlike PHP, I wanted changes to show without > kicking users off. > now I am afraid to use touch. > > > On Thursday, March 7, 2013 8:54:15 AM UTC-5, Roberto López López wrote: >> >> >> Check the history of the files you've touched, and rollback all >> indentation changes. >> >> >> >> On 03/07/2013 02:49 PM, frocco wrote: >> > Hello, >> > >> > I am not sure what happened, I did a touch wsgi and then a touch >> wsgi.py >> > I got an error afterwards and could not recover from it. I could not >> > find the views.py it was complaining about. >> > I tried to reload the site from a backup and still had errors. I ended >> > up recreating the site on webfaction and uploading each app until it >> was >> > working. >> > >> > >> > IndentationError at / >> > >> > unindent does not match any outer indentation level (views.py, line 29) >> > >> > Django Version:1.5 >> > Exception Type:IndentationError >> > Exception Value: >> > >> > unindent does not match any outer indentation level (views.py, line 29) >> > >> > Exception Location: >> > /home/frocco/webapps/ntw/lib/python2.7/django/utils/importlib.py in >> > import_module, line 35 >> > Python Executable:/usr/local/bin/python >> > Python Version:2.7.3 >> > Python Path: >> > >> > ['/home/frocco/webapps/ntw', >> > '/home/frocco/webapps/ntw/myproject', >> > '/home/frocco/webapps/ntw/lib/python2.7', >> > '/home/frocco/lib/python2.7/pip-1.2.1-py2.7.egg', >> > '/home/frocco/lib/python2.7', >> > '/usr/local/lib/python27.zip', >> > '/usr/local/lib/python2.7', >> > '/usr/local/lib/python2.7/plat-linux2', >> > '/usr/local/lib/python2.7/lib-tk', >> > '/usr/local/lib/python2.7/lib-old', >> > '/usr/local/lib/python2.7/lib-dynload', >> > '/usr/local/lib/python2.7/site-packages', >> > '/usr/local/lib/python2.7/site-packages/PIL'] >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Django users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an email to django-users...@googlegroups.com. >> > To post to this group, send email to django...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/django-users?hl=en. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> >> -- >> Kind regards, >> >> Roberto L�pez L�pez >> >> >> System Developer >> Parallab, Uni Computing >> H�yteknologisenteret, Thorm�hlensgate 55 >> N-5008 Bergen, Norway >> Tel:(+47) 555 84091 >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Need some ideas for how to implement a two-part form
I'm working on a project that requires a RSVP form for an event. The first step of the form would ask first & last name, e-mail, attending (yes/no/unsure), and total number of guests attending. Currently I have this form correctly working and submitting to the database. The second step of the form would interact with a second table which would be the guest list and it would only contain the first & last name of each guest along with who registered them. It would give enough forms to add the names of the guests from that party attending (based on number submitted in the first step and only if the rsvp response was Yes). The registered by column should be filled automatically and be hidden on the client-side. So far I have this working for just one name entry (pulls from POST data). So the real question is, what is the best way to go about adding a secondary form which automatically provides enough name fields based on the field filled in the first form? Also it should add the registering guest's name to the first set of fields for convenience. I'd be open to adding some sort of js/jquery/ajax/whatever to have the form be all one page and dynamically add the number of name fields but still save those to the second database 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.
Re: Challenge with installing django on windows 7 64 bit
Hello- I only develop django on osx and lunix (ubuntu), but I've looked into options for installing it on my windows desktop- even though I've never gotten around to it... I've found http://www.instantdjango.com/ which has all the common files you need to develop in one package. According to the site, you don't even need to install anything, just extract the .exe and work there. 7-zip documentation says that it should be able to unzip tar.gz, but maybe you somehow got a corrupted download. Have you tried downloading it again? On Jan 26, 11:23 am, Magge wrote: > Hi, > > I am trying to extract the installation files from the > Django-1.2.4.tar.gz file that I got from the django website. I tried > using winzip, 7z, cygwin and so forth. All these programs complain > that the file isnt a valid archive. > > I used to work with django back in 2009 on Window. The installation > used to be off the extract of a zip file I remember. How do I get > going with the installation? > > I appreciate any inputs on this > > Thanks > Keshav Magge -- 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.