This happened when I ran sync.db. All the other tables were created.

I'm using South but I ran sync.db first to create the initial tables. When 
I ran South, the 'profiles' app still didn't appear.

There's also a signals.py file with the following:

def create_profile(sender, instance, signal, created, **kwargs):
    """When user is created also create a matching profile."""
 
    from stentorian.report.models import UserProfile
 
    if created:
        UserProfile(user = instance).save()

On Thursday, July 5, 2012 1:06:26 PM UTC-4, DF wrote:
>
> I have a problem that I hope someone with insight can aid with. My first 
> Django project is near completion and I’m currently transitioning to a 
> Postgres database in anticipation of deploying via Heroku. The process was 
> going fairly smoothly until this occurred when I ran python manage.py 
> syncdb:
>
> django.db.utils.DatabaseError: relation "report_userprofile" does not exist
> LINE 1: INSERT INTO "report_userprofile" ("user_id", "first_name", "...
>
> Apparently, it did not create DB tables for the UserProfile model. I’m now 
> getting this exception when I attempt to run the server:
>
> xception Type: DoesNotExist at /accounts/login/
> Exception Value: Site matching query does not exist.
>
> Among the additional apps I'm using for the project is django-profiles, 
> which I had some issues setting up which are apparently common. The 
> "Missing Manual" site –
> http://birdhouse.org/blog/2009/06/27/django-profiles/ – helped resolve 
> those but may have led to the current problem.
>
> I am using the signals.post_save.connect(create_profile, sender=User) 
> recommended there. I was researching what might have gone wrong and came 
> across this post on Google Groups and answer which states that “If you’re 
> using a post_save signal on User you can’t do that because it results in a 
> race condition." I’m wondering if this may be causing the issue and, 
> obviously, what would be best to resolve it and get these tables into the 
> new database and functioning.
>
> This is the database model:
>
> class UserProfile(models.Model):
>
>     user = models.OneToOneField(User, unique=True, related_name="profile")
>
>     first_name = models.CharField(max_length=25)
>
>     last_name = models.CharField(max_length=35)
>
>     email = models.EmailField()
>
>     birth_date = models.DateField(blank=True, null=True)
>
>     city = models.CharField(max_length=25)
>
>     state = models.CharField(max_length=20)
>
>     zip_code = models.CharField(max_length=10)
>
>     profile_pic = models.ImageField(upload_to='profilepictures', 
> blank=True)
>
>
>     def __unicode__(self):
>
>         return " %s" % (self.user)
>
>
>     def get_absolute_url(self):
>
>         return ('profiles_profile_detail', (), { 'username': 
> self.user.username })
>
>     get_absolute_url = models.permalink(get_absolute_url)
>
>     signals.post_save.connect(create_profile, sender=User)
>
>
> Any insight into how to remedy this issue would be greatly appreciated.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/0eVvl2dDNI8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to