Could it be related to a third-party app similar to 
https://code.djangoproject.com/ticket/27365#comment:12 ?

On Thursday, May 4, 2017 at 5:12:47 PM UTC-4, Evan Heidtmann wrote:
>
> Hello Django friends,
>
>
> My app, running in production with uwsgi, very occasionally will crash 
> because of a FieldError on a (valid) reverse ForeignKey relationship field. 
> Without any code changes, other requests will succeed. Tests that cover 
> this code path always pass. 
>
>
> The two models are in different apps. Both apps are listed in 
> INSTALLED_APPS and the calling module imports both models modules at top 
> level. One of the models is "replaceable" but I'm using the original model 
> (it's oauth2_provider.Application)
>
>
> # app1/models.pyclass A(models.Model):
>     name = models.CharField(max_length=20)
> def get_A_model():
>     # ... some thirdparty code for replaceable models ...
> # app2/models.pyclass B(models.Model):
>     myname = models.CharField(max_length=20)
>     a = models.ForeignKey('app1.A')
> # app2/views.pyimport app1.models as app1_modelsfrom . import models
> def view(request):
>    # This line crashes with "FieldError: Cannot resolve keyword 'b' into 
> field. Choices are: ..."
>     qs = app1_models.get_A_model().objects.filter(b__myname='larry')
>
>
> This smells like some kind of deployment issue (code loading too late or 
> not at all?) but if so, I don't know how to debug. Thanks for taking a look 
> and let me know what I can do to gather more helpful information.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6769b832-e478-4890-9036-49094e12a644%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to