title: Django: Missing tables for profiles when converting to Postgres database
body: <p>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.</p>
  
  <pre><code>django.db.utils.DatabaseError: relation “report_userprofile” does not exist
  LINE 1: INSERT INTO “report_userprofile” (“user_id”, “first_name”, “…
  </code></pre>
  
  <p>Apparently, it did not create DB tables for the UserProfile model. I’m now getting this exception when I attempt to run the server:</p>
  
  <pre><code>Exception Type: DoesNotExist at /accounts/login/
  Exception Value: Site matching query does not exist.
  </code></pre>
  
  <p>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 – <a href="http://birdhouse.org/blog/2009/06/27/django-profiles/" rel="nofollow">http://birdhouse.org/blog/2009/06/27/django-profiles/</a> – helped resolve those but may have led to the current problem. </p>
  
  <p>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.</p>
  
  <p>Any insight into how to remedy this issue would be greatly appreciated.</p>
  
  <p>This is the database model that may be causing the problem:</p>
  
  <pre><code>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)
  </code></pre>