(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py migrate
Operations to perform:
Synchronize unmigrated apps: colleges, ads, debug_toolbar, comments, communities, main, athletes, ad_manager
Apply all migrations: admin, contenttypes, sites, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Creating table athletes_athlete_athletecolleges
Creating table athletes_athlete_athletecommunities
Creating table athletes_athlete
Creating table athletes_registrationprofile
Creating table colleges_college
Creating table colleges_collegeevent_attendees
Creating table colleges_collegeevent
Creating table communities_community
Creating table communities_country
Creating table communities_city
Creating table communities_communitypost_city
Creating table communities_communitypost_country
Creating table communities_communitypost
Creating table comments
Creating table comment_flags
Creating table main_teammember
Creating table ads_partner
Creating table ads_ad
Creating table ad_manager_target
Creating table ad_manager_adgroup
Creating table ad_manager_ad
Creating table ad_manager_pagetype
Creating table ad_manager_adtype
Creating table ad_manager_tagtype
Installing custom SQL...
Installing indexes...
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Next up I called to create a super user and that went fine as well:
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py createsuperuser
Username (leave blank to use 'jjz'):
Email address:
Password:
Password (again):
Superuser created successfully.
Then I ran the makemigrations command for the respective apps and their models that I wanted to have:
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations colleges
Migrations for 'colleges':
0001_initial.py:
- Create model College
- Create model CollegeEvent
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations ads
Migrations for 'ads':
0001_initial.py:
- Create model Ad
- Create model Partner
- Add field partner to ad
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations comments
Migrations for 'comments':
0001_initial.py:
- Create model Comment
- Create model CommentFlag
- Alter unique_together for commentflag (1 constraint(s))
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations communities
Migrations for 'communities':
0001_initial.py:
- Create model City
- Create model Community
- Create model CommunityPost
- Create model Country
- Add field country to communitypost
- Add field user to communitypost
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations main
Migrations for 'main':
0001_initial.py:
- Create model TeamMember
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py makemigrations athletes
Migrations for 'athletes':
0001_initial.py:
- Create model Athlete
- Create model RegistrationProfile
Up until this point I had no concerns, things seemed to be working as expected, but what happened next stunned me. The migrate command hung it just sat there seemingly doing nothing. I hit command c to cancel because I'm on a mac thinking maybe I had done something wrong and it wouldn't happen again but it continues.
I tried to run runserver next:
(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
^C(zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py migrate
^C
As you can see it hung and I had to cancel and hit command c on both runserver and the following migrate.
Sorry for the wall of text but I just want to put this all out there in case it gives any awareness. Anyways, here is my speculation to what is causing the "endless loop" within my models, I say this because I didn't have this issue up until I started messing with this part of my models. Here is one of those models (because it has the user FK):
# College Event
class CollegeEvent(models.Model):
collegeid = models.CharField(max_length=30)
user = models.ForeignKey('athletes.Athlete', verbose_name=_('user'), blank=True, null=True, related_name="%(class)s_events")
creatorname = models.CharField(max_length=30)
creatorurl = models.CharField(max_length=30)
ispublished = models.BooleanField(default=False)
name = models.CharField(max_length=30)
description = models.TextField()
startdate = models.CharField(max_length=30)
enddate = models.CharField(max_length=30)
attendees = models.ManyToManyField(settings.AUTH_USER_MODEL, null=True, blank=True)
objects = models.Manager()
ceobjects = CollegeEventManager()
def __unicode__(self):
return self.name
def get_creator_full_name(self):
return self.user.first_name + " " + self.user.last_name
The key line being:
user = models.ForeignKey('athletes.Athlete', verbose_name=_('user'), blank=True, null=True, related_name="%(class)s_events")
# Athlete User
class Athlete(models.Model):
athleteuser = models.OneToOneField(User)
athleteavatar = models.ImageField("Profile Pic", upload_to="images/", blank=True, null=True, default='images/None/no-img.jpeg')
athletebirthday = models.DateField()
athleteurl = models.CharField(max_length=30, unique=True) # Must limit to a-z && A-Z && and 0-9 chars, validators=[validate_slug]
athletecommunities = models.ManyToManyField('communities.Community')
athletecolleges = models.ManyToManyField('colleges.College')
- Modified migrations dependency algorithm to avoid possible infinite recursion.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd5c0b56-44fd-436f-b957-ad2cbfcd63a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment