Django 1.7.1로 업그레이드되었고 새로운 개발 환경을 설정하려고합니다. 나는 사용자 마이그레이션 확인을 실행,하지만 난 트윗을 마이그레이션을 실행하려고 할 때, 나는 그래서이 순환 종속성을 추적하기 위해 노력하고있어 django.db.migrations.graph.CagularDependencyError in Django 1.7.1
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 106, in handle
plan = executor.migration_plan(targets)
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/db/migrations/executor.py", line 49, in migration_plan
for migration in self.loader.graph.forwards_plan(target):
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/db/migrations/graph.py", line 55, in forwards_plan
return self.dfs(node, lambda x: self.dependencies.get(x, set()))
File "/Users/libbyh/Documents/virtualenvs/fyl/lib/python2.7/site-packages/django/db/migrations/graph.py", line 105, in dfs
raise CircularDependencyError()
django.db.migrations.graph.CircularDependencyError
를 얻을./models.py
from django.db import models
# Create your models here.
class UsersTweets(models.Model):
id = models.IntegerField(primary_key=True)
user = models.ForeignKey('users.User')
tweet = models.ForeignKey('tweets.Tweet')
source = models.BooleanField() # sent the tweet
target = models.BooleanField() # received a reply in the tweet
class Meta:
managed = True
class User(models.Model):
id = models.IntegerField(primary_key=True)
twitter_id = models.CharField(max_length=21, unique=True)
twitter_name = models.CharField(max_length=55, unique=True)
fullname = models.CharField(max_length=45)
followers = models.IntegerField()
following = models.IntegerField()
favorites = models.IntegerField()
tweets = models.IntegerField()
timezone = models.CharField(max_length=45, blank=True)
legislator = models.ForeignKey('users.Legislator', blank=True, null=True)
class Meta:
managed = True
class Legislator(models.Model):
id = models.IntegerField(primary_key=True)
PARTY = (
('Democrat','Democrat'),
('Republican','Republican'),
('Independent','Independent'),
)
GENDER = (
('M','Man'),
('F','Woman'),
)
TYPE = (
('sen','Senator'),
('rep','Representative')
)
STATE = (
('AK', 'Alaska'),
('AL', 'Alabama'),
('AR', 'Arkansas'),
('AS', 'American Samoa'),
('AZ', 'Arizona'),
('CA', 'California'),
('CO', 'Colorado'),
('CT', 'Connecticut'),
('DC', 'District of Columbia'),
('DE', 'Delaware'),
('FL', 'Florida'),
('GA', 'Georgia'),
('GU', 'Guam'),
('HI', 'Hawaii'),
('IA', 'Iowa'),
('ID', 'Idaho'),
('IL', 'Illinois'),
('IN', 'Indiana'),
('KS', 'Kansas'),
('KY', 'Kentucky'),
('LA', 'Louisiana'),
('MA', 'Massachusetts'),
('MD', 'Maryland'),
('ME', 'Maine'),
('MI', 'Michigan'),
('MN', 'Minnesota'),
('MO', 'Missouri'),
('MP', 'Northern Mariana Islands'),
('MS', 'Mississippi'),
('MT', 'Montana'),
('NA', 'National'),
('NC', 'North Carolina'),
('ND', 'North Dakota'),
('NE', 'Nebraska'),
('NH', 'New Hampshire'),
('NJ', 'New Jersey'),
('NM', 'New Mexico'),
('NV', 'Nevada'),
('NY', 'New York'),
('OH', 'Ohio'),
('OK', 'Oklahoma'),
('OR', 'Oregon'),
('PA', 'Pennsylvania'),
('PR', 'Puerto Rico'),
('RI', 'Rhode Island'),
('SC', 'South Carolina'),
('SD', 'South Dakota'),
('TN', 'Tennessee'),
('TX', 'Texas'),
('UT', 'Utah'),
('VA', 'Virginia'),
('VI', 'Virgin Islands'),
('VT', 'Vermont'),
('WA', 'Washington'),
('WI', 'Wisconsin'),
('WV', 'West Virginia'),
('WY', 'Wyoming'),
)
last_name = models.CharField(max_length=17, blank=True)
first_name = models.CharField(max_length=11, blank=True)
gender = models.CharField(max_length=1, blank=True)
chamber = models.CharField(max_length=3, blank=True)
state = models.CharField(max_length=2, blank=True)
party = models.CharField(max_length=11, blank=True)
url = models.CharField(max_length=36, blank=True)
address = models.CharField(max_length=55, blank=True)
phone = models.CharField(max_length=12, blank=True)
contact_form = models.CharField(max_length=103, blank=True)
rss_url = models.CharField(max_length=106, blank=True)
facebook = models.CharField(max_length=27, blank=True)
facebook_id = models.IntegerField(blank=True, null=True)
youtube = models.CharField(max_length=20, blank=True)
youtube_id = models.IntegerField(blank=True, null=True)
bioguide_id = models.IntegerField(blank=True, null=True)
thomas_id = models.IntegerField(blank=True, null=True)
opensecrets_id = models.IntegerField(blank=True, null=True)
lis_id = models.IntegerField(blank=True, null=True)
cspan_id = models.IntegerField(blank=True, null=True)
govtrack_id = models.IntegerField(blank=True, null=True)
votesmart_id = models.IntegerField(blank=True, null=True)
ballotpedia_id = models.IntegerField(blank=True, null=True)
washington_post_id = models.IntegerField(blank=True, null=True)
icpsr_id = models.IntegerField(blank=True, null=True)
wikipedia_id = models.CharField(max_length=40, blank=True)
def _get_name_with_honor(self):
return '%s. %s %s (%s-%s)' % ((self.chamber).title(), self.first_name, self.last_name, self.party[:1], self.state)
honor_name = property(_get_name_with_honor)
def __unicode__(self):
return self.last_name
class Meta:
managed = True
트윗/models.py
from django.db import models
# Create your models here.
class Tweet(models.Model):
tweet_id = models.CharField(primary_key=True, max_length=21)
created_at = models.DateTimeField()
text = models.CharField(max_length=255)
source = models.CharField(max_length=255, blank=True)
location_geo = models.TextField(blank=True) # This field type is a guess.
location_geo_0 = models.DecimalField(max_digits=14, decimal_places=10, blank=True, null=True)
location_geo_1 = models.DecimalField(max_digits=14, decimal_places=10, blank=True, null=True)
iso_language = models.CharField(max_length=3)
user = models.ManyToManyField('users.User', through = "users.UsersTweets")
class Meta:
managed = True
내가 another StackOverflow question about this error을 확인
사용자,하지만 난하지 않습니다 여기 모델은 마이그레이션 할 준비가 의존성이 어디에 있을지에 대한 내 오류의 모든 정보. this advice을 따르려고했으나 swappable_dependency
을 (를) 수정하는 방법을 모르 셨습니다. 어떤 아이디어? 감사!
해결 했습니까? – doniyor
여전히 슬프게도. 한동안 그것을 보지 않고 있었다. – Libby