私のDjangoアプリは、本番環境で提供されているバージョン(Apache経由、静的にはNginx経由)を使用すると不可解なエラーを発生させます。これは、ローカルホストの開発サーバーバージョンでは明らかではありません。
私はモデルを持っています:
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
と ..
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
関連する Archetype オブジェクトを取得しようとすると:
library_archetypes = library_item.applies_to.all()
次のエラーが表示されます。
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
開発版とローカル版は同じデータベースを使用しており、AdaptationLibrary ManyToManyField への呼び出しを除いて、アプリの残りの部分は正常に機能します。
誰でもこの問題に光を当てることができますか?
乾杯
編集:それは移行の問題であるというRohanの提案によると、私は南にリセットして再変換するというボックスとダイス全体を行ってきました。開発サーバーはまだ満足しています - Apache が提供するバージョンは同じエラーをスローします。どちらのバージョンも同じ DB を使用しています。
(完全なトレースバック エラー):
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