Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:21:22+00:00 2026-06-13T13:21:22+00:00

My Django app is raising a puzzling error when using a production served version

  • 0

My Django app is raising a puzzling error when using a production served version (via Apache, and Nginx for static), that is not evident for the dev server version on localhost.

I have the models :

class AdaptationLibrary(models.Model):
    description = models.CharField( u'Description of adaptation',max_length=400,blank=True,null=True)
    name = models.CharField(u'Adaptation Name',max_length=60)
    applies_to = models.ManyToManyField(Archetype,related_name =u'archetype_adaptations',null=True,blank=True)
    adaptations = jsonfield.JSONField(u'adaptation library items', null=True, blank=True)
    def __unicode__(self):
        return self.name

and ..

class Archetype(models.Model):
    archetype = models.CharField(max_length=20, choices=ARCHETYPE_CHOICES,unique=True)
    archetype_family = models.CharField(max_length=60,choices=ARCHETYPE_FAMILY_CHOICES,null=True)
    replacement_cost_default = models.FloatField("Default complete asset replacement cost - ($)",null=True, blank=True)
    lifespan_default = models.FloatField("Default asset life (yrs)", null=True, blank=True)
    age_default = models.FloatField("Default age - (yrs)", null=True, blank=True)
    storage_time_default = models.FloatField("Default storage/retention time (hrs)", null=True, blank=True)
    def __unicode__(self):
        return self.archetype

when I attempt to retrieve related Archetype objects via :

library_archetypes = library_item.applies_to.all()

I get the following error :

FieldError: Cannot resolve keyword u'archetype_adaptations' into field.
Choices are: age_default, archetype, archetype_family, asset, cemlo2, id,
lifespan_default, new_dependency, replacement_cost_default, storage_time_default

Dev and local versions are using the same database, and apart from the call to the AdaptationLibrary ManyToManyField, the rest of the app functions fine.

Can anybody shed some light on this issue?

Cheers

Edit:
As per Rohan’s suggestion that it’s a migration problem – I’ve gone the whole box and dice of resetting and re-converting to south. Dev server is still happy – Apache served version throws same errors. Both versions are using the same DB.

(full traceback error) :

ERROR Traceback (most recent call last):

  File "C:\Python27\Lib\site-packages\dajaxice\core\DajaxiceRequest.py", line 181, in process
response = '%s' % thefunction(self.request, **argv)

  File "C:/Python27/sites/Adaptwater\proto4\ajax.py", line 2636, in populate_adaptation_library
initial_data = dict_to_library_form(library_item_id = library_to_load)

  File "C:/Python27/sites/Adaptwater\proto4\ajax.py", line 2556, in dict_to_library_form
library_archetypes = library_item.applies_to.all()

 File "C:\Python27\Lib\site-packages\django\db\models\manager.py", line 116, in all
return self.get_query_set()

  File "C:\Python27\Lib\site-packages\django\db\models\fields\related.py", line 543, in get_query_set
return super(ManyRelatedManager, self).get_query_set().using(db)._next_is_sticky().filter(**self.core_filters)

  File "C:\Python27\Lib\site-packages\django\db\models\query.py", line 621, in filter
return self._filter_or_exclude(False, *args, **kwargs)

  File "C:\Python27\Lib\site-packages\django\db\models\query.py", line 639, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))

  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1250, in add_q
can_reuse=used_aliases, force_having=force_having)

  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1122, in add_filter
process_extras=process_extras)

  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1316, in setup_joins
"Choices are: %s" % (name, ", ".join(names)))

FieldError: Cannot resolve keyword u'archetype_adaptations' into field. Choices are: age_default, archetype, archetype_family, asset, cemlo2, id, lifespan_default, new_dependency, replacement_cost_default, storage_time_default
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:21:23+00:00Added an answer on June 13, 2026 at 1:21 pm

    Ok – sorry for the self answer, but I fixed the problem, even if I’m still mostly in the dark as to what caused it. After some additional serious googling, I found discussion about the problem in terms of ordering of imports, and model definitions both. For example :

    http://chase-seibert.github.com/blog/2010/04/30/django-manytomany-error-cannot-resolve-keyword-xxx-into-a-field.html

    After placing the AdaptationLibrary model ahead of Archetype in models.py (and quoting “Archetype” for m2m setup) it appears to be happy. Unless I’m missing something blindingly obvious, this feels like a voodoo fix. Up until now I’d been fastidiously putting referred to models before their referring buddies. But it’s a fix nonetheless – so now back to work.

    Cheers & Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a Django app on Apache + mod_python. When I make some changes
I have a Django app that gets it's data completely from an external source
Building a Django app on a VPS. I am not very experienced with setting
I have a Django app that use a django-tagging. I need to port this
I have configured my Django app to run under Apache+FastCGI on Linux (Ubuntu, if
I have a Django app which, submitting a package, should return values that are
We have a Django app running on apache server (mod_python) on a windows machine
So I have a Django app that processes test results, and I'm trying to
A Django app that I am working has an Event model. An Event may
I have a Django app deployed on Google App Engine that prematurely logs its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.