2009-05-19 2 views
0

나는 실행이 오류를 얻고있다와 장고 응용 프로그램을 마이그레이션하려고 할 때 "이전 ./manage.py APP_NAME"나는 확신오류 남쪽

While loading migration 'whatever.0001_initial': 
Traceback (most recent call last): 
File "manage.py", line 14, in <module> execute_manager(settings) 

...tons of other stuff.. 

    raise KeyError("The model '%s' from the app '%s' is not available in this migration." % (model, app)) 
KeyError: "The model 'appuser' from the app 'whatever' is not available in this migration." 

모델 "APPUSER은"모두 응용 프로그램 models.py에 있음 그리고 models.py에서 0001_initial.py

APPUSER 모델 :

class AppUser(models.Model): 
    person = models.OneToOneField('Person') 
    user = models.ForeignKey(User, unique=True) 
    class Meta: 
     permissions = (
      ('is_one', 'one'), 
      ('is_two', 'two') 
     ) 
    def __unicode__(self): 
     return self.person.__unicode__() 

APPUSER 모델 0001_initial.py에서 :

# Adding model 'AppUser' 
    db.create_table('app_appuser', (
     ('person', models.OneToOneField(orm.Person)), 
     ('id', models.AutoField(primary_key=True)), 
     ('user', models.ForeignKey(orm['auth.User'], unique=True)), 
    )) 
    db.send_create_signal('app', ['AppUser']) 
    ... 
    'app.appuser': { 
     'Meta': {'permissions': "(('is_one','one'),('is_two','two'))"}, 
     'id': ('models.AutoField', [], {'primary_key': 'True'}), 
     'person': ('models.OneToOneField', ["'Person'"], {}), 
     'user': ('models.ForeignKey', ['User'], {'unique': 'True'}) 
    }, 

빈 데이터베이스 (예 : 아니오 "app_ *"같은 테이블) :

manage.py migrate app 

이 보인다 맥 OS, 우분투/파이썬 2.6

질문에 아무 probs에만 파이썬 2.5에서 발생하는 수 - 어떻게 해결 하는가?

감사합니다.

답변

2

문제는 0001_initial.py 파일의 모델 순서와 관련이있는 것으로 보입니다. AppUser에서 파생 된 클래스가있었습니다.

manage.py startmigration app --initial 

으로 마이그레이션을 다시 만들었을 때 우분투에서 생성 된 것과 비교해 보면 모델 순서가 다릅니다. 그래서 Mac OS에서 주문과 일치하도록 주문을 변경하면 모든 것이 잘되었습니다.

이 문제는 남쪽의 0.5 버전에서만 존재하는 것으로 보이며 트렁크에 고정되어있을 것으로 추정됩니다.