Django throws ImproperlyConfigured error when loading URLconf on startup

2012-11-28 Thread Michael Dippery
I have a Django app running on a production server. It is handled with gunicorn 
0.14.2 behind nginx. When I reload the app (by reloading the gunicorn workers), 
I get this error:

---
Traceback (most recent call last):

 File 
"/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/handlers/base.py", 
line 101, in get_response
   request.path_info)

 File 
"/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py", 
line 250, in resolve
   for pattern in self.url_patterns:

 File 
"/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py", 
line 283, in _get_url_patterns
   raise ImproperlyConfigured("The included urlconf %s doesn't have any 
patterns in it" % self.urlconf_name)

ImproperlyConfigured: The included urlconf myapp.urls doesn't have any patterns 
in it
---

Others with this problem have commonly noted that it occurs while using reverse 
in a URLconf, but I am not using reverse in any URLconfs (nor are they used in 
any third-party apps). Also, this error only occurs in production -- never in 
development (using the Django dev server) or on my staging server (also using 
gunicorn 0.14.2 behind nginx). It also doesn't seem to cause trouble with the 
site at any other time then during reloads. And it only happens for the first 
10-20 requests on the website (which makes me wonder if it's some sort of race 
condition, perhaps).

Any ideas what's causing the problem?

-- 
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: getting back max date from a joined table for list_display

2010-12-16 Thread Michael Dippery
On Dec 16, 2010, at 3:53 AM, dan kirkland wrote:

> Hi, I'm new to python and django and need to join two tables together
> - the first table holds details about a customer and I think is
> probably passed as the obj parameter of the following function. The
> second is a CallBackRequest table that holds details of when I should
> next call a customer. The callback has a foreign key (customer_id) to
> the customer table. I want the customers and their next callback
> (based on max date) to be displayed in a list - see the list_display
> line. Note, there's a one-to-many relationship between customer and
> callbackrequest records.
> 
> The details in the customer table are retrieved and displayed
> successfully in the list but the date of the next call back is blank.
> I'm almost certain it's to do with the filter but not sure how to join
> the foreign key of the callbackrequest with the primary key of the obj
> record. Almost certainly the pk reference is wrong as it's the foreign
> key I need anyway. The foreign key within callbackrequests is called
> customer_id.

What about this?

def next_call_back_due(self, obj):
call_records = 
CallbackRequest.objects.filter(customer_id=obj.id).order_by('-call_back_date')
if call_records.count() > 0:
return call_records[0].call_back_date
    else:
return None# Or whatever default you want to return




Michael Dippery
mdipp...@gmail.com | www.monkey-robot.com



smime.p7s
Description: S/MIME cryptographic signature


Why might a Django admin form hang (or, how can I diagnose the problem)?

2010-12-15 Thread Michael Dippery
I have a model tied to the admin. Whenever I try to add a new model instance, 
or update an existing one, the form hangs while trying to submit. Nothing is 
written to the log files, though. The models are nothing fancy, so they don't 
have any custom validation that may be causing, e.g., and infinite loop. Also, 
the hang only occurs on my production server, not on the staging server or my 
local development machine.

Any ideas as to what might be causing the hang? Or, since that's probably hard 
to answer without all the specifics of my setup and application, what's the 
best way to diagnose the problem?




Michael Dippery
mdipp...@gmail.com | www.monkey-robot.com



smime.p7s
Description: S/MIME cryptographic signature