Hey guys!
I've got a real stumper here. Pulling my hair out over this one, would really appreciate some options!
Anywhere in my application that calls user.get_profile() causes a FieldError.. but only in production. I'm using WSGI and Apache.
When I run locally with:
python manage.py runserver
0.0.0.0:9999it works just fine. However, running the exact same code and the exact same database with Apache, I get a 500 and find this in the logs:
[Wed Feb 12 21:23:21 2014] [error] [client] FieldError: Cannot resolve keyword 'user' into field. Choices are: about_me, about_me_mkd, etc..
(Full traceback:
http://pastebin.com/6141pHZ2)
When I run sqlall, there is a users_id entry for the model:
"user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED
What could possibly be happening here? What could the difference between devserver and Apache?
(For reference, this is using Django-Userena 1.0, Django 1.3.7. and Postgres 8.4.)
I've tried a few things I found on the internet:
http://stackoverflow.com/questions/19145787/fielderror-cannot-resolve-keyword-xxxx-into-fieldhttp://chase-seibert.github.io/blog/2010/04/30/django-manytomany-error-cannot-resolve-keyword-xxx-into-a-field.htmlWhich both suggest that it has something to do with the order of the imports, but I haven't had any success with this approach.
There is an extremely old Django bug seemingly related to this,
https://code.djangoproject.com/ticket/1796but I don't know how relevant this is, as this is not a ManyToMany problem, because Userena uses a OneToOne field:
user = models.OneToOneField(User,
unique=True,
verbose_name=_('user'),
related_name='profile')
Can anybody help me? I'm going nuts over here. I just don't know why the behavior would be different for runserver and Apache!
Any ideas?
Thanks so much!,
Rich